var throttle=function(n,t,i){t||(t=250);var r,u;return function(){var e=i||this,f=+new Date,o=arguments;r&&f<r+t?(clearTimeout(u),u=setTimeout(function(){r=f;n.apply(e,o)},t)):(r=f,n.apply(e,o))}};$.fn.fixedHeader=function(n){var i=$(this),s=i.find(".logo"),r=null,u=!0,t=function(){return $("#breakpoint-test-mobile").is(":visible")},h=function(){return t()?20:45},c=function(){return t()?10:18},e=function(){return t()?10:45},l=function(){return t()?220:233},a=function(){return t()?.5:.71},v=function(){return t()?8:1},y=function(){return t()?5:3},p=function(){u=!0},w=function(){u=!1},o=function(){var n=Math.min(jQuery(document).scrollTop()/y(),e()),k=Math.floor(n*a()),f=1/e()*n,d=.15*f,g=t()?15-9*f:15,o=Math.round(13*f)+242,b;i.css("padding-top",h()-k+"px");i.css("padding-bottom",c()-(n-k)+"px");s.css("width",l()-n*v());i.css("box-shadow","0px 0 30px 0px rgba(0,0,0,"+d.toFixed(2)+")");i.find(".header-nav-container").css("padding-top",g);i.css("background-image","linear-gradient(to right, #fff 21%, rgba("+o+", "+o+", "+o+", 0.9) 100%)");b=jQuery(document).scrollTop()<r.activationPoint;b&&!u&&p();!b&&u&&w()},f={init:function(){jQuery(function(){jQuery(window).on("resize scroll",throttle(function(){o()},20));o()})}};if(f[n])return r=this.data("opts"),f[n].apply(this,Array.prototype.slice.call(arguments,1));if(typeof n!="object"&&n)$.error("Method "+n+" does not exist on jQuery.background-parallax");else return r=$.extend({},{$target:null,activationPoint:20,animationSpeed:600},n),this.each(function(){return $(this).data("opts",r),f.init.apply($(this))});return $(this)},function(n){n.fn.ellipsis=function(){return this.each(function(){var i=n(this),t=i.data("original-text"),r,u;for(typeof t=="undefined"&&(t=i.html(),i.data("original-text",t)),i.css("overflow","hidden"),r=n(this.cloneNode(!0)).hide().html(t).css("position","absolute").css("overflow","visible").width(i.width()).height("auto"),i.after(r);t.length>0&&r.height()>i.height();)u=t.lastIndexOf(" "),u<2&&(u=t.length-1),t=t.substr(0,u),r.html(t+"...");i.html(r.html());r.remove()})}}(jQuery);$.fn.parallax=function(n){var t=$(this),r=t.parent(),h=t.siblings(".hero-content"),i=null,f,e=function(n){t.css("height",Math.ceil(n)+"px")},c=function(){return $("#breakpoint-test-mobile-menu").is(":visible")},o=function(){return c()?i.mobileParallaxScrollHeight:i.parallaxScrollHeight},s=function(n){var v,c;n&&(f=$(window).height());var y=$(window).scrollTop(),l=r.offset(),s=r.height(),a=Math.max(l.top-f,0),p=l.top+s,w=Math.min((y-a)/(p-a),1),i,u=o().toLowerCase();if(u==="inherit"||u==="")i=t.outerHeight()-t.height();else if(u.indexOf("%")>-1)v=parseFloat(u),i=r.height()*(v/100),e(i+s);else if(u.indexOf("px")>-1)i=parseInt(u),e(i+s);else throw"Parallax background '"+o+"' unit not supported.";c=i*w;t.css("top",(c*-1).toFixed(0)+"px");h.css("top",(c/2.5).toFixed(0)+"px")},u={init:function(){$(window).on("scroll resize",throttle(function(n){t.is(":visible")&&s(n.type==="resize")},15,t));s(!0)}};if(u[n])return i=this.data("opts"),u[n].apply(this,Array.prototype.slice.call(arguments,1));if(typeof n!="object"&&n)$.error("Method "+n+" does not exist on jQuery.background-parallax");else return i=$.extend({},{$target:null,parallaxScrollHeight:"70%",mobileParallaxScrollHeight:"30%"},n),this.each(function(){return $(this).data("opts",i),u.init.apply($(this))});return $(this)},function(n){n.fn.menu=function(t){var e=!1,i,h,l=n(".header-nav-container"),y=n.extend({},n.fn.menu.defaults,t),r=n(this),u=n(r).find(".has-children > ul"),o=function(){return n("#breakpoint-test-mobile-menu").is(":visible")},c=function(t){t&&n(window).scrollTop(0);n(r).closest("header").toggleClass("disable-fix",t)},a=function(){var t=n(l).outerHeight()+h.outerHeight(),i=t>n(window).height();c(i)},v=function(){n(".mobile-nav-button").addClass("mobile-nav-button-selected");h=i;var t=i.children("li");t.hide();i.css("z-index",2).fadeIn(360);n(t[0]).fadeIn(300);setTimeout(function(){var n=t.slice(1),i=400;n.children().hide().fadeIn(i);n.slideDown(i,function(){e=!0;o()?c(!0):a()})},120)},f=function(t){e=!1;n(".mobile-nav-button").removeClass("mobile-nav-button-selected");n(r).closest("header").removeClass("disable-fix");t.css("z-index",1).fadeOut(300)},s;r.find(".has-children > a").click(function(t){var r=n(this).siblings("ul");f(o()?r:u);i=r;i!=null&&i.is(":visible")||v();t.preventDefault()});n(document).mouseup(function(t){e&&n(t.target).closest("nav.header-nav-container").length===0&&f(u)});n(".menu-hamburger").click(function(){f(u);r.children("ul.top-menu").fadeToggle(400)});s=n(window).width();n(window).on("resize",throttle(function(){var t=n(window).width();s!==t&&(o()||r.children("ul.top-menu").show(),f(u),s=t)},100,u));return this};n.fn.menu.defaults={}}(jQuery);var BizCheckResult=function(){function n(){this.totalScore=0;this.phases=[];this.personName="";this.companyName="";this.emailAddress="";this.phone=""}return n}(),BizCheckPhaseResult=function(){function n(){this.phaseName="";this.phaseKey="";this.score=0;this.questions=[]}return n}(),BizCheckQuestionResult=function(){function n(){this.questionId=0;this.score=0}return n}(),BizCheckSurvey=function(){function n(n){this.scoreAttr="bizcheck-score";this.$element=null;this.phases=[];this.$element=n;n.data("bizcheck-survey",this)}return n}(),BizCheckPhase=function(){function n(n){this.scoreAttr="bizcheck-score";this.$element=null;this.questions=[];this.$element=n;n.data("bizcheck-phase",this);this.phaseName=n.data("bizcheck-name");this.phaseKey=n.data("bizcheck-key")}return n}(),BizCheckQuestion=function(){function n(n){this.scoreAttr="bizcheck-score";this.$element=null;this.answers=[];this.score=-1;this.id=-1;this.$element=n;n.data("bizcheck-question",this)}return n}(),BizCheckAnswer=function(){function n(n){this.$element=null;this.$element=n;n.data("bizcheck-answer",this)}return n}(),BizCheck=function(){function n(){this.surveySelector='[data-bizcheck="survey"]';this.phaseSelector='[data-bizcheck="phase"]';this.questionSelector='[data-bizcheck="question"]';this.answerSelector='[data-bizcheck="answer"]';this.stepSelector='[data-bizcheck="step"]';this.nextButtonSelector='[data-bizcheck="move-next"]';this.phaseResultSelector='[data-bizcheck="phase-result"]';this.phaseResultBarSelector='[data-bizcheck="phase-result-bar"]';this.phaseResultNameSelector='[data-bizcheck="phase-result-name"]';this.phaseResultPhaseIdAttribute="data-bizcheck-phaseid";this.surveyResultSelector='[data-bizcheck="survey-result"]';this.surveyResultBarSelector='[data-bizcheck="survey-result-bar"]';this.surveyResultPercentageSelector='[data-bizcheck="survey-result-percentage"]';this.glossarySelector='[data-bizcheck="glossary"]';this.model=new BizCheckResult;this.testResults=!1;this.submissionContentId=0;this.isInitialised=!1}return n.prototype.getScoreName=function(n){return n>80?"Excellent":n>60?"Very good":n>40?"Good":n>20?"Average":"Poor"},n.prototype.setButtonStatus=function(n){this.activeStep.find(this.nextButtonSelector).toggleClass("disabled",!n)},n.prototype.setActiveNavItem=function(n){$(".bizcheck-nav li").removeClass("active").filter(".progress-"+n).addClass("active")},n.prototype.validateEmail=function(n){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(n)},n.prototype.getFormPersonName=function(){return this.model.personName},n.prototype.setFormPersonName=function(n){this.model.personName=n;this.survey.$element.find("#form-name,#early-form-name").val(n)},n.prototype.getFormCompanyName=function(){return this.model.companyName},n.prototype.setFormCompanyName=function(n){this.model.companyName=n;this.survey.$element.find("#form-company,#early-form-company").val(n)},n.prototype.getFormPhone=function(){return this.model.phone},n.prototype.setFormPhone=function(n){this.model.phone=n;this.survey.$element.find("#form-phone,#early-form-phone").val(n)},n.prototype.getFormEmailAddress=function(){return this.model.emailAddress},n.prototype.setFormEmailAddress=function(n){this.model.emailAddress=n;this.survey.$element.find("#form-email,#early-form-email").val(n)},n.prototype.validateForm=function(){var t=$("#form-name"),i=$("#form-company"),r=$("#form-phone"),u=$("#form-email"),f=$("#privacy-checkbox");this.setFormPersonName(t.val());this.setFormCompanyName(i.val());this.setFormPhone(r.val());this.setFormEmailAddress(u.val());var e=this.getFormPersonName().length>3,o=this.getFormCompanyName().length>3,s=this.getFormPhone().length>3,n=this.getFormEmailAddress(),h=n.indexOf("@"),c=n.length>4&&h>1&&n.lastIndexOf(".")>h,l=f.is(":checked");return t.toggleClass("invalid",!e),i.toggleClass("invalid",!o),r.toggleClass("invalid",!s),u.toggleClass("invalid",!c),f.toggleClass("invalid",!l),e&&o&&s&&c&&l},n.prototype.setActiveStep=function(n){var t=this,u=this.activeStep,r=!1,i;typeof this.activeStep=="undefined"||this.activeStep==null?(this.activeStep=$(this.steps[0]),r=!0):u.data("bizcheck-step")==="start"&&(this.setFormPersonName($("#early-form-name").val()),this.setFormCompanyName($("#early-form-company").val()),this.setFormPhone($("#early-form-phone").val()),this.setFormEmailAddress($("#early-form-email").val()));i=this.activeStep.outerHeight();i>0&&this.survey.$element.children(".step-frame").height(i);this.activeStep.fadeOut(500,function(){var f,e,u,o,s;t.activeStep=n;r&&t.loadState();t.refreshModel();f=t.activeStep.data("bizcheck-step");f==="start"?t.setActiveNavItem("go"):f==="question"?(t.activeQuestion=$(t.activeStep.find(t.questionSelector)[0]).data("bizcheck-question"),t.setActiveNavItem(t.activeQuestion.phase.phaseKey),t.setButtonStatus(t.activeQuestion.score!==-1)):f==="form"?(e=t.validateForm(),$(t.activeStep.find(".form-complete")).toggle(e),$(t.activeStep.find(".form-incomplete")).toggle(!e),t.setButtonStatus(e),t.setActiveNavItem("done")):f==="results"&&(u=t.model.totalScore,$.each(t.model.phases,function(n,i){var r=t.activeStep.find("["+t.phaseResultPhaseIdAttribute+"='"+i.phaseKey+"']");t.testResults&&(i.score=Math.round(Math.random()*100));r.find(t.phaseResultBarSelector).each(function(n,t){$(t).data("bizcheck-score",i.score).children().css("width","0")});r.find(t.phaseResultNameSelector).text(t.getScoreName(i.score)).hide()}),t.testResults&&(u=Math.round(Math.random()*100)),o=t.activeStep.find(t.surveyResultSelector),o.find(t.surveyResultPercentageSelector).data("bizcheck-score",u).text("0%"),o.find(t.surveyResultBarSelector).data("bizcheck-score",u).children().css("width","0"),t.submit(t.model),t.activeStep.find(".result-description").hide().removeClass("active"),u<=25?$("#result-description-low").addClass("active"):u<=50?$("#result-description-medium").addClass("active"):u<=75?$("#result-description-high").addClass("active"):$("#result-description-excellent").addClass("active"),setTimeout(function(){t.animateResults()},500));s=t.activeStep.show().outerHeight();t.activeStep.hide().fadeIn(500);i>0?t.survey.$element.children(".step-frame").height(i).animate({height:s},700,function(){t.survey.$element.children(".step-frame").height("")}):t.survey.$element.children(".step-frame").height("")})},n.prototype.animateResults=function(){var n=this,r=30,t=0;this.activeStep.find(this.phaseResultBarSelector).each(function(n,i){var u=$(i).data("bizcheck-score"),f=r*u;t=Math.max(f,t);$(i).children().animate({width:u+"%"},f)});setTimeout(function(){n.activeStep.find(n.phaseResultNameSelector).fadeIn(2e3);n.activeStep.find(".result-description.active").slideDown(1e3)},t);var u=this.activeStep.find(this.surveyResultBarSelector),f=u.data("bizcheck-score"),e=f*r;u.children().animate({width:f+"%"},e);var i=this.activeStep.find(this.surveyResultPercentageSelector),s=i.data("bizcheck-score"),o=-1;i.prop("counter",0).animate({Counter:s},{duration:e,easing:"linear",step:function(n){n!==o&&i.text(Math.ceil(n)+"%");o=n}})},n.prototype.saveState=function(n){localStorage.setItem("bizcheck_state",JSON.stringify(n))},n.prototype.loadState=function(){var i=this,t=localStorage.getItem("bizcheck_state"),n=t&&JSON.parse(t);n!=null&&(this.model=n,this.setFormPersonName(n.personName),this.setFormCompanyName(n.companyName),this.setFormPhone(n.phone),this.setFormEmailAddress(n.emailAddress),$.each(n.phases,function(n,t){$.each(t.questions,function(n,t){$("[data-bizcheck-questionId="+t.questionId+"] input[value="+t.score+"]").prop("checked",!0)})}));this.survey.$element.find(this.answerSelector+":checked").each(function(n,t){i.updateAnswer($(t))})},n.prototype.initialise=function(){var n=this;this.survey=new BizCheckSurvey($(this.surveySelector));this.onScoreChange=function(){};this.steps=this.survey.$element.find(this.stepSelector);$(this.phaseSelector).each(function(t,i){var u=$(i),r=new BizCheckPhase(u);r.survey=n.survey;n.survey.phases.push(r);u.find(n.questionSelector).each(function(t,i){var f=$(i),u=new BizCheckQuestion(f);u.id=Number(f.attr("data-bizcheck-questionId"));u.phase=r;r.questions.push(u);f.find(n.answerSelector).each(function(n,t){var r=$(t),i=new BizCheckAnswer(r);i.question=u;u.answers.push(i)})})});this.setActiveStep($(this.steps[0]));this.survey.$element.on("click",this.answerSelector,function(t){n.updateAnswer($(t.target));n.onScoreChange()});this.survey.$element.on("click",this.nextButtonSelector,function(t){if($(t.target).hasClass("disabled"))$(t.target).closest("#form-step").length>0&&n.survey.$element.addClass("highlight-validation-errors");else{var i=n.steps[n.steps.index(n.activeStep)+1];n.setActiveStep($(i));$("html,body").animate({scrollTop:0},Math.max(300,$(window).scrollTop()*2))}t.preventDefault()});$('[data-bizcheck="close"]').click(function(t){$("#bizcheck-frame").fadeOut(700);$("#bizcheck-background").fadeOut(3e3);n.setActiveStep($(n.steps[0]));t.preventDefault()});$(document).on("click",".question-content a",function(t){var i=$(t.target).attr("href");$(n.glossarySelector).show().find(".glossary-content").html("<div class='loading'>Loading...<\/div>");$.get(i,function(t){$(n.glossarySelector).find(".glossary-content").hide().html(t).fadeIn(500)});t.preventDefault()});$('[data-bizcheck="glossary-close"]').click(function(t){$(n.glossarySelector).fadeOut(500);t.preventDefault()});$(".progress-done").dblclick(function(t){t.shiftKey&&n.setActiveStep($("#form-step"))});$("#main-form input").keyup(function(){var t=n.validateForm();n.setButtonStatus(t)});$("#privacy-checkbox").change(function(){var t=n.validateForm();n.setButtonStatus(t)});$("#early-privacy-checkbox").change(function(n){$("#privacy-checkbox").prop("checked",$(n.target).prop("checked"))})},n.prototype.open=function(){this.isInitialised||(this.isInitialised=!0,this.initialise());var n=$("#bizcheck-background");n.fadeTo(500,.99,function(){window.scrollTo(0,0);$("#bizcheck-frame").fadeIn(1200,function(){n.fadeTo(700,.8)})})},n.prototype.updateAnswer=function(n){var i=n.val(),t=n.data("bizcheck-answer");t.question.score=i;t.question.$element.find("label").toggleClass("selected",!1);n.parent("label").addClass("selected");this.setButtonStatus(!0)},n.prototype.refreshModel=function(){var n=new BizCheckResult,t=0,i=0,r;n.personName=this.getFormPersonName();n.companyName=this.getFormCompanyName();n.emailAddress=this.getFormEmailAddress();n.phone=this.getFormPhone();$.each(this.survey.phases,function(u,f){var o=0,s=0,e=new BizCheckPhaseResult;$.each(f.questions,function(n,t){r=t.score;o+=Number(r);s++;var i=new BizCheckQuestionResult;i.questionId=t.id;i.score=t.score;e.questions.push(i)});t+=o;i+=s;e.phaseName=f.phaseName;e.phaseKey=f.phaseKey;e.score=o/s;n.phases.push(e)});n.totalScore=t/i;this.saveState(n);this.model=n},n.prototype.submit=function(n){var t=this,i=this.submissionContentId===0?null:this.submissionContentId;$.post("/api/save-bizcheck",{submissionId:i,resultData:n},function(n){t.submissionContentId=n.contentId})},n}();$(function(){function c(n){var t=-1;return n.each(function(){t=t>$(this).height()?t:$(this).height()}),t}function l(n){n.css("height","auto");var t=c(n);n.css("height",t)}function e(){var n=[];f.each(function(t,i){var r=$(i).attr("data-equalise-height-group"),u;$.inArray(r,n)&&(u=$("[data-equalise-height-group="+r+"]"),n.push(r),l(u))})}function o(n){$("<img/>").attr("src",n)}var i,t,r,u,f,n;if($("nav.header-nav-container").menu(),$("header").fixedHeader(),i=$(".article-details .ellipsis"),t=function(){i.height($(".article-photo").height()-50).ellipsis()},$(window).resize(throttle(function(){t()},100)),t(),r=new BizCheck,$('[data-bizcheck="open"]').click(function(n){n.preventDefault();r.open()}),u=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,u||$.getScript("//f.vimeocdn.com/js/froogaloop2.min.js",function(){var n=$(".video-play-button");n.fadeIn(2e3).click(function(n){var t=$(n.target).siblings("iframe")[0],i=$f(t);i.api("play");$(this).stop().fadeOut(500)})}),$(".contact-form button").click(function(n){n.preventDefault();var t=$(n.target).closest(".contact-form"),i=t.find("#form-contact-email").val(),r=t.find("#form-contact-phone").val(),u=t.find("#form-contact-message").val();if(i.length<6&&r.length<6||u.length<6){$(".contact-form-validation-message").slideDown(500);return}$(".contact-form-overlay").show();$.post("/api/contact-message",{email:i,phone:r,message:u},function(){$(".contact-form-validation-message").slideUp(500);t.find(".overlay-message").html("Message received, thank you!")})}),f=$("[data-equalise-height-group]"),$(window).resize(function(){e()}),e(),n=$(".animate-logo img"),n.length>0){var s=n.data("static"),a=n.data("graphic"),v=2150,h=a+"?ipignore=true&cv="+Math.ceil(Math.random()*99999);o(s);o(h);$(window).load(function(){n.css("background-image","url("+h+")");setTimeout(function(){n.attr("src",s).css("background-image","none")},v+3e3)})}})