function convertNumeric(n){var t=ko.unwrap(n);return t?Number(t.toString().replace(/[^0-9\.-]+/g,"")):0}function convertCurrency(n){if(n!==undefined)return n=n.toString(),n=n.replace(/^0+/,""),n=n.replace(/\D/g,""),n="$"+n.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"),n==="$"?n+"0":n}function convertPercentage(n){if(n!==undefined)return n=n.toString(),n=n.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,")+"%",n==="%"?"0"+n:n}function formatAsCurrency(n){if(n!==undefined){var t=n.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,");return t===""&&(t="0"),"$"+t.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,")}}function tryFindAndSetObservable(n,t,i){try{var r=n(),u=t().find(i);n(u)}catch(f){n(r)}}function trySetObservable(n,t){try{if(t!==null&&t){var i=n();n(t)}}catch(r){n(i)}}function runTokenizer(){if(!isMode("xp")){var n=new Replacer;n.setStrategy(new TokenReplacerStrategy);$(".calculatorSection .dynamictext").each(function(t,i){var r=$(i);r&&n.strategy.replaceTokens(r)})}}function initialiseCalculator(){var n=$(".calculator-component");n!==undefined&&n.length==1&&(runTokenizer(),ko.applyBindings(window.viewModel,n[0]),$("input.sizeToContent").each(function(){function i(){n.is(":visible")&&(t.text(n.val()),n.width(t.width()<30?30:t.width()))}var n=$(this),t=$("<span />");t.css({display:"none","font-family":n.css("font-family"),"font-size":n.css("font-size"),"font-weight":n.css("font-weight")});t.insertBefore(n);setTimeout(i,500);n.on("input change",i);n.next(".ui-slider").on("slidechange",i)}),$(window).resize(function(){ForceResizeEvents();setTimeout(refreshTopPanel,350)}),$(window).scroll(function(){MakeTopPanelStickyIfScrolledPast()}),refreshTopPanel())}function MakeTopPanelStickyIfScrolledPast(){if(!isMode("xp")){if(HasScrolledPastWaypoint($topPanelWaypoint)&&window.isDesktop){if(!$topPanelSection.hasClass(stickyClass)){var n=$topPanelSection.parents(".calculatorSection").outerHeight();$topPanelSection.parents(".calculatorSection").css("min-height",n);$topPanelSection.addClass(stickyClass)}}else $topPanelSection.parents(".calculatorSection").css("min-height",""),$topPanelSection.removeClass(stickyClass);HasScrolledPastWaypoint($mobileWaypoint)&&!window.isDesktop?$mobilePanel.hasClass(stickyClass)||($mobilePanel.addClass(stickyClass),$(window).trigger("StickyMenuChanged")):$mobilePanel.hasClass(stickyClass)&&($mobilePanel.removeClass(stickyClass),$(window).trigger("StickyMenuChanged"))}}function HasScrolledPastWaypoint(n){return n[0]&&n[0].offsetTop<(window.scrollY||document.documentElement.scrollTop)}function refreshTopPanel(){isBreakpointOrLower("sm")?($topPanelSection.removeClass(stickyClass),window.isDesktop=!1):window.isDesktop=!0}function ForceResizeEvents(){$(".fitText").trigger("fittext")}var ProductViewModel;String.prototype.format=function(){for(var i,t=this,n=0;n<arguments.length;n++)i=new RegExp("\\{"+n+"\\}","gi"),t=t.replace(i,arguments[n]);return t};ko.bindingHandlers.valueAsCurrency={init:function(n,t,i){var u,f,e,r,o;allBindings=i();allBindings.inputOptions&&(u=allBindings.inputOptions.min,f=allBindings.inputOptions.max,e=allBindings.inputOptions.default);r=t();o=ko.computed({read:function(){var n=r();return isNaN(n)&&r(e),convertCurrency(r())},write:function(t){t=convertNumeric(t);f!==undefined&&t>f&&(t=f);u!==undefined&&t<u&&(t=u);r(isNaN(t)?e:t);n.value=convertCurrency(r())},disposeWhenNodeIsRemoved:n});ko.applyBindingsToNode(n,{value:o})}};ko.bindingHandlers.valueAsFormat={init:function(n,t,i){var r,u,f;allBindings=i();r={min:allBindings.inputOptions.min,max:allBindings.inputOptions.max,formatString:allBindings.inputOptions.formatString};r.formatString||(r.formatString="{0}");u=t();f=ko.computed({read:function(){return r.formatString.format(u())},write:function(t){t=convertNumeric(t);t>r.max&&(t=r.max);t<r.min&&(t=r.min);u(isNaN(t)?null:t);n.value=r.formatString.format(u())},disposeWhenNodeIsRemoved:n});ko.applyBindingsToNode(n,{value:f})}};ko.bindingHandlers.valueAsPercentage={init:function(n,t,i){allBindings=i();var r={min:allBindings.inputOptions.min,max:allBindings.inputOptions.max},u=t(),f=ko.computed({read:function(){return convertPercentage(u())},write:function(t){t=convertNumeric(t);t>r.max&&(t=r.max);t<r.min&&(t=r.min);u(isNaN(t)?null:t);n.value=convertPercentage(u())},disposeWhenNodeIsRemoved:n});ko.applyBindingsToNode(n,{value:f})}};ko.bindingHandlers.tabs={init:function(n,t){var i=$(n).find("ul"),r=$(i).find("li"),u=ko.utils.unwrapObservable(t());i.on("click","li",function(){$(this).hasClass("active")||($(this).parents(".tabList").find("li").removeClass("active"),$(this).addClass("active"),u())});r.each(function(n,t){n===0&&$(t).addClass("active")})},update:function(){}};ko.bindingHandlers.currency={init:function(n,t,i,r){ko.bindingHandlers.value.init(n,t,i,r)},update:function(n,t){ko.utils.unwrapObservable(t());var i=t();i()!==undefined&&(i(i().replace(/\D/g,"")),i(i().replace(/^0+/,"")),Number(i())>2e9&&i(2e9),i(formatAsCurrency(i())),t()(i()))}};ko.bindingHandlers.textCustom={init:function(n,t,i,r){ko.bindingHandlers.text.init(n,t,i,r)},update:function(n,t){ko.utils.setTextContent(n,t())}};ko.bindingHandlers.textCurrencyFormat={init:function(n,t,i,r){ko.bindingHandlers.text.init(n,t,i,r)},update:function(n,t,i){var u=ko.unwrap(t()),f=i(),r=u;r=convertNumeric(r);f.showCents===!0?Math.round(r)!==r&&(r=r.toFixed(2)):r=Math.round(r);r=formatAsCurrency(r);ko.utils.setTextContent(n,r)}};ko.bindingHandlers.textPercentage={init:function(n,t,i,r){ko.bindingHandlers.text.init(n,t,i,r)},update:function(n,t){var r=ko.unwrap(t()),i;r!==undefined&&(i=r,Math.round(i)!==i&&(i=i.toFixed(2)),i=convertPercentage(i),ko.utils.setTextContent(n,i))}};ko.bindingHandlers.slider={init:function(n,t,i){function o(n,i){e&&e(!0);t()(r.range===!0?i.values:i.value)}function s(){e&&e(!1)}var f=ko.utils.unwrapObservable(t()),u=i(),e=u.sliderOptions.activeState,r={min:u.sliderOptions.min,max:u.sliderOptions.max,range:u.sliderOptions.range,"default":u.sliderOptions.default};t()(r.default);u.sliderOptions.continuous?r.slide=o:r.change=o;r.stop=s;r.range===!0?r.values=(Object.isArray(f)?f:Object.isString(f)&&f.split(",").length===2?f.split(",").map(function(n){return parseInt(n,10)}):null)||[r.min,r.max]:r.value=r.default;u.sliderOptions.step&&(r.step=u.sliderOptions.step);$(n).append('<div class="ui-slider-handle"><\/div>');$(n).slider(r)},update:function(n,t,i){var r=ko.utils.unwrapObservable(t()),u=i();u.sliderOptions.range===!0?$(n).slider("values",r):$(n).slider("value",r)}};var Replacer=function(){this.strategy="";this.setStrategy=function(n){this.strategy=n}},TokenPair=function(n,t){var i=this;i.id=n;i.html=t},TokenReplacerStrategy=function(){var n=[];n.push(new TokenPair("$loanFrequency_dropdown",'<span class="special-dropdown"><label><select data-bind="options: $root.loanFrequencies, optionsText: \'lyname\', value: $root.selectedLoanFrequency"><\/select><\/label><\/span>'));n.push(new TokenPair("$loanFrequency_lyname",'<span data-bind="text: $root.selectedLoanFrequency().lyname"><\/span>'));n.push(new TokenPair("$loanFrequency_paypername",'<span data-bind="text: $root.selectedLoanFrequency().paypername"><\/span>'));n.push(new TokenPair("$assetValue",'<span data-bind="textCurrencyFormat: $root.tokens.assetValue()"><\/span>'));n.push(new TokenPair("$assetUse",'<span data-bind="text: $root.tokens.assetUse()"><\/span>'));n.push(new TokenPair("$loanAmount",'<span data-bind="textCurrencyFormat: $root.tokens.loanAmount()"><\/span>'));n.push(new TokenPair("$heritageRepayments_totalSaved",'<span class="totalSaved" data-bind="textCurrencyFormat: $root.tokens.heritageRepayments_totalSaved()"><\/span>'));n.push(new TokenPair("$heritageRepayments_yearsSaved",'<span class="yearsSaved" data-bind="text: $root.tokens.heritageRepayments_yearsSaved()"><\/span>'));n.push(new TokenPair("$state",'<span data-bind="text: $root.tokens.state()"><\/span>'));n.push(new TokenPair("$lvr",'<span data-bind="text: $root.tokens.lvr()"><\/span>'));n.push(new TokenPair("$insurance_heading",'<span data-bind="text: $root.tokens.insurance_heading()"><\/span>'));n.push(new TokenPair("$insurance_blurb",'<span data-bind="text: $root.tokens.insurance_blurb()"><\/span>'));this.replaceTokens=function(t){var i=this;i.textElement=t;n.forEach(function(n){var t=n.html;i.textElement[0].innerHTML=i.textElement[0].innerHTML.replaceAll(n.id,t)})}};var stickyClass="sticky",$topPanelWaypoint=$("#TopPanelWaypoint"),$topPanelSection=$("#toppanelsection"),$mobileWaypoint=$("#MobileStickyWaypoint"),$mobilePanel=$("#mobileTopPanelSticky");$("#mobileTopPanelSticky .pencil-icon").on("click",function(){var n=$(this).data("scrollto");$("html, body").animate({scrollTop:$(n)[0].offsetTop},600)});var LoanFrequencyViewModel=function(n,t,i,r){var u=this;u.lyname=n;u.paypername=t;u.repaymentsPerYear=i;u.repaymentsPerMonth=r},weeklyLoanFrequency=new LoanFrequencyViewModel("weekly","per week",52,4),fortnightlyLoanFrequency=new LoanFrequencyViewModel("fortnightly","per fortnight",26,2),monthlyLoanFrequency=new LoanFrequencyViewModel("monthly","per month",12,1),allLoanFrequencies=[weeklyLoanFrequency,fortnightlyLoanFrequency,monthlyLoanFrequency],OptionViewModel=function(n,t,i){var r=this;r.name=n;r.value=t;r.text=i},queensland=new OptionViewModel("QLD","QLD","Queensland"),newSouthWales=new OptionViewModel("NSW","NSW","New South Wales"),southAustralia=new OptionViewModel("SA","SA","South Australia"),australianCapitalTerritory=new OptionViewModel("ACT","ACT","the Australian Capital Territory"),victoria=new OptionViewModel("VIC","VIC","Victoria"),westernAustralia=new OptionViewModel("WA","WA","Western Australia"),tasmania=new OptionViewModel("TAS","TAS","Tasmania"),northernTerritory=new OptionViewModel("NT","NT","the Northern Territory"),allStates=[queensland,newSouthWales,southAustralia,australianCapitalTerritory,victoria,westernAustralia,tasmania,northernTerritory];(function(n){window.HBS=n.extend(window.HBS||{},{calculators:{calculateRepaymentsInterestOnly:function(n,t,i,r){if(n===undefined||t===undefined||i===undefined||r===undefined)return undefined;var e=i*r,o=t/100,s=o/i,u=n*s,f=e*u+n,h=f-n;return{repaymentAmount:u,totalPaid:f,interestPaid:h}},calculateRepayments:function(n,t,i,r){var e,s;if(n===undefined||t===undefined||i===undefined||r===undefined)return undefined;var f=i*r,h=t/100,o=h/i,u=o*n/(1-Math.pow(1+o,-Math.abs(f)));return isFinite(u)||(u=n/f),e=f*u,s=e-n,{repaymentAmount:u,totalPaid:e,interestPaid:s}},calculateRepaymentsRequired:function(n,t,i,r){if(n===undefined||t===undefined||i===undefined||r===undefined)return undefined;var e=t/100,u=e/i,f=Math.log(u/(r/n-u)+1)/Math.log(1+u),o=f*r;return{totalRepayments:f,totalPaid:o}}}})})(jQuery);ProductViewModel=function(n,t,i,r){var u=this;u.id=ko.observable(n.Id);u.productName=ko.observable(n.ProductName);u.subtitle=ko.observable(n.Subtitle);u.interestRate=ko.observable(n.Rate);u.comparisonRate=ko.observable(n.ComparisonRate);u.rateType=ko.observable(n.RateType);u.features=ko.observable("<div>"+n.Features+"<\/div>");u.applicationFee=ko.observable(n.UpFrontApplicationFee);u.annualFee=ko.observable(n.AnnualLoanServiceFee);u.feeCostPerRepayment=ko.pureComputed(function(){var n=t();return n?u.annualFee()/12/n.repaymentsPerMonth:null});u.totalPaid=ko.observable(0);u.interestPaid=ko.observable(0);u.repaymentAmount=ko.computed(function(){var n=i(),f=u.interestRate(),o=t().repaymentsPerYear,e=r(),c=!1,s,h;return n===undefined||f===undefined||o===undefined||e===undefined?undefined:(s=c?window.HBS.calculators.calculateRepaymentsInterestOnly(n,f,o,e):window.HBS.calculators.calculateRepayments(n,f,o,e),o===12?(u.totalPaid(s.totalPaid),u.interestPaid(s.interestPaid)):(h=c?window.HBS.calculators.calculateRepaymentsInterestOnly(n,f,12,e):window.HBS.calculators.calculateRepayments(n,f,12,e),u.totalPaid(h.totalPaid),u.interestPaid(h.interestPaid)),s.repaymentAmount)});u.repaymentAmountRounded=ko.pureComputed(function(){return Math.round(u.repaymentAmount()*100)/100});u.heritageRepaymentAmount=ko.computed(function(){var n=i(),f=u.interestRate(),e=12,o=r(),s;return n===undefined||f===undefined||e===undefined||o===undefined?undefined:(s=window.HBS.calculators.calculateRepayments(n,f,e,o),s.repaymentAmount/t().repaymentsPerMonth)});u.heritageRepaymentAmountRounded=ko.pureComputed(function(){return Math.round(u.heritageRepaymentAmount()*100)/100});u.showSavings=ko.pureComputed(function(){return t().repaymentsPerMonth>1});u.totalSavedWithHeritageRepayments=ko.observable();u.yearsSavedWithHeritageRepayments=ko.computed(function(){var f=i(),e=u.interestRate(),n=t().repaymentsPerYear,o=u.heritageRepaymentAmount();if(f===undefined||e===undefined||n===undefined||o===undefined)return undefined;var s=window.HBS.calculators.calculateRepaymentsRequired(f,e,n,o),h=r(),c=h-s.totalRepayments/n,l=u.totalPaid()-s.totalPaid;return u.totalSavedWithHeritageRepayments(l),Math.round(c*10)/10+" years"})},function(){var n=$("#personalloancalculator-component");if(n!==undefined&&n.length==1){var t=function(){var n=this;n.loanFrequencies=ko.observableArray(allLoanFrequencies);n.selectedLoanFrequency=ko.observable(fortnightlyLoanFrequency);n.topPanel=new i;n.howWeCanHelpYou=new r(n.topPanel.loanPurpose,n.topPanel.loanAmount,n.topPanel.termInYears,n.selectedLoanFrequency);n.insurance=new u(n.topPanel.loanPurpose,n.selectedLoanFrequency);n.totalCostSummary=new f(n.howWeCanHelpYou.selectedProduct,n.insurance.estimate,n.selectedLoanFrequency);n.whatIfRatesChange=new e(n.howWeCanHelpYou.selectedProduct,n.topPanel.loanAmount,n.topPanel.termInYears,n.selectedLoanFrequency);n.totalUpFrontCosts=new o(n.howWeCanHelpYou.selectedProduct);n.tokens={assetValue:undefined,assetUse:undefined,loanAmount:ko.computed(function(){return n.topPanel.loanAmount()}),heritageRepayments_totalSaved:ko.computed(function(){var t=n.howWeCanHelpYou.selectedProduct();if(t!==undefined)return t.totalSavedWithHeritageRepayments()}),heritageRepayments_yearsSaved:ko.computed(function(){var t=n.howWeCanHelpYou.selectedProduct();if(t!==undefined)return t.yearsSavedWithHeritageRepayments()}),state:undefined,lvr:undefined,insurance_heading:ko.computed(function(){return n.insurance.heading()}),insurance_blurb:ko.computed(function(){return n.insurance.blurb()})};n.errorStates={noErrors:ko.computed(function(){return isMode("xp")?!0:n.howWeCanHelpYou.products().length===0?!1:n.topPanel.loanAmount()>=5e3&&n.topPanel.loanAmount()<=1e5}),error1:ko.computed(function(){return isMode("xp")?!0:n.topPanel.loanAmount()<5e3}),error2:ko.computed(function(){return isMode("xp")?!0:n.topPanel.loanAmount()>1e5})};new s(n)},i=function(){var n=this;n.loanPurpose=ko.observable();n.loanAmount=ko.observable();n.termInYears=ko.observable()},r=function(n,t,i,r){var u=this,e,f,o;u.maximumProducts=ko.observable();u.products=ko.observableArray([]);u.selectedProduct=ko.observable();u.productFeatures=ko.computed(function(){var n=u.selectedProduct();if(n)return n.features});ko.computed(function(){var o=n(),s=t(),h=i(),c=u.maximumProducts();o&&s&&h&&c&&(f&&f.loanPurpose==o&&f.loanAmount==s&&f.termInYears==h&&f.maxResults==c||(e&&e.abort(),f={loanPurpose:o,loanAmount:s,termInYears:h,maxResults:c},e=$.get("/hapi/products/personalloans",f,function(n){var e,f,o;n.length!==0&&(e=n.map(function(n){return new ProductViewModel(n,r,t,i)}),u.products(e),f=u.selectedProduct(),f&&(o=f.id(),f=$.grep(e,function(n){return n.id()===o})[0]),f||(f=e[0]),u.selectedProduct(f),bindDisclaimers())})))});u.selectedProduct.subscribe(function(){o!==undefined&&clearTimeout(o);o=setTimeout(ForceResizeEvents,100)})},u=function(n,t){var i=this;i.heading=ko.observable();i.blurb=ko.observable();n.subscribe(function(){var n=$("#loan-purpose option:selected");n&&(i.heading(n.data("insurance-heading")),i.blurb(n.data("insurance-blurb")))});i.annualInsuranceCost=ko.observable();i.estimate=ko.computed(function(){var n=t().repaymentsPerYear;return i.annualInsuranceCost()/n})},f=function(n,t,i){var r=this;r.subtitle=ko.computed(function(){var t=n();if(t!==undefined)return t.subtitle()});r.heritageRepaymentAmount=ko.computed(function(){var t=n();if(t!==undefined)return t.heritageRepaymentAmount()});r.totalPaid=ko.computed(function(){var t=n();if(t!==undefined)return t.totalPaid()});r.interestPaid=ko.computed(function(){var t=n();if(t!==undefined)return t.interestPaid()});r.loanFee=ko.computed(function(){var t=n();if(t!==undefined)return t.feeCostPerRepayment()});r.showSavings=ko.computed(function(){return i().repaymentsPerMonth>1});r.insuranceEstimate=t;r.totalOngoingCosts=ko.computed(function(){var n=r.heritageRepaymentAmount(),t=r.insuranceEstimate(),i=r.loanFee();return n+t+i})},e=function(n,t,i,r){var u=this;u.incrementAmount=.5;u.minRateChange=-5;u.maxRateChange=5;u.changeRateBy=ko.observable(.5);u.decrement=function(){var n=u.changeRateBy()-u.incrementAmount;n<u.minRateChange&&(n=u.minRateChange);u.changeRateBy(n)};u.increment=function(){var n=u.changeRateBy()+u.incrementAmount;n>u.maxRateChange&&(n=u.maxRateChange);u.changeRateBy(n)};u.newInterestRate=ko.computed(function(){var t=n();if(t!==undefined)return t.interestRate()+u.changeRateBy()});u.newRepaymentAmount=ko.computed(function(){var n=t(),f=u.newInterestRate(),e=12,o=i(),s;return n===undefined||f===undefined||e===undefined||o===undefined?undefined:(s=window.HBS.calculators.calculateRepayments(n,f,e,o),s.repaymentAmount/r().repaymentsPerMonth)})},o=function(n){var t=this;t.applicationFee=ko.computed(function(){var t=n();if(t!==undefined)return t.applicationFee()})},s=function(n){var t=!1;$(function(){$.get("/hapi/contactdata/personalloan",function(t){trySetObservable(n.topPanel.loanPurpose,t.LoanPurpose);trySetObservable(n.topPanel.loanAmount,t.LoanAmount);trySetObservable(n.topPanel.termInYears,t.LoanTerm);tryFindAndSetObservable(n.selectedLoanFrequency,n.loanFrequencies,function(n){return n.lyname==t.LoanFrequency});trySetObservable(n.insurance.annualInsuranceCost,t.AnnualInsuranceCost)}).always(function(){t=!0})});ko.computed(function(){var i={LoanPurpose:n.topPanel.loanPurpose(),LoanAmount:n.topPanel.loanAmount(),LoanTerm:n.topPanel.termInYears(),LoanFrequency:n.selectedLoanFrequency().lyname,AnnualInsuranceCost:n.insurance.annualInsuranceCost()};t&&$.post("/hapi/contactdata/personalloan",i)}).extend({rateLimit:{timeout:2e3,method:"notifyWhenChangesStop"}})};window.viewModel=new t;initialiseCalculator()}}();$(function(){$(".collapse-panel").children(".panel-header").click(function(){if(!$(this).next(".panel-collapse").hasClass("collapsing")){$(this).find(".glyphicon-plus, .glyphicon-remove").toggleClass("glyphicon-plus glyphicon-remove");var n=$(this).parent();$(this).next(".panel-collapse").collapse("toggle")}})});!function(n){"use strict";function gt(){}function a(n,t,i,r){"addEventListener"in window?n.addEventListener(t,i,cr?r||{}:!1):"attachEvent"in window&&n.attachEvent("on"+t,i)}function ni(n,t,i){"removeEventListener"in window?n.removeEventListener(t,i,!1):"detachEvent"in window&&n.detachEvent("on"+t,i)}function ti(n){return n.charAt(0).toUpperCase()+n.slice(1)}function lr(n){var i,r,f,t=null,u=0,e=function(){u=rt();t=null;f=n.apply(i,r);t||(i=r=null)};return function(){var s=rt(),o;return u||(u=s),o=w-(s-u),i=this,r=arguments,0>=o||o>w?(t&&(clearTimeout(t),t=null),u=s,f=n.apply(i,r),t||(i=r=null)):t||(t=setTimeout(e,o)),f}}function ii(n){return nt+"["+tt+"] "+n}function t(n){lt&&"object"==typeof console&&console.log(ii(n))}function s(n){"object"==typeof console&&console.warn(ii(n))}function ar(){vr();t("Initialising iFrame ("+location.href+")");yr();wr();ut("background",di);ut("padding",gi);tu();fi();ei();br();ru();oi();y=iu();h("init","Init message from host page");pt()}function vr(){function i(n){return"true"===n?!0:!1}var t=ir.substr(ur).split(":");tt=t[0];ot=n!==t[1]?Number(t[1]):ot;g=n!==t[2]?i(t[2]):g;lt=n!==t[3]?i(t[3]):lt;c=n!==t[4]?Number(t[4]):c;e=n!==t[6]?i(t[6]):e;d=t[7];r=n!==t[8]?t[8]:r;di=t[9];gi=t[10];vt=n!==t[11]?Number(t[11]):vt;y.enable=n!==t[12]?i(t[12]):!1;at=n!==t[13]?t[13]:at;u=n!==t[14]?t[14]:u}function yr(){function i(){var n=window.iFrameResizer;t("Reading data from page: "+JSON.stringify(n));yt="messageCallback"in n?n.messageCallback:yt;pt="readyCallback"in n?n.readyCallback:pt;p="targetOrigin"in n?n.targetOrigin:p;r="heightCalculationMethod"in n?n.heightCalculationMethod:r;u="widthCalculationMethod"in n?n.widthCalculationMethod:u}function n(n,i){return"function"==typeof n&&(t("Setup custom "+i+"CalcMethod"),bt[i]=n,n="custom"),n}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(i(),r=n(r,"height"),u=n(u,"width"));t("TargetOrigin for parent set to: "+p)}function pr(n,t){return-1!==t.indexOf("-")&&(s("Negative CSS value ignored for "+n),t=""),t}function ut(i,r){n!==r&&""!==r&&"null"!==r&&(document.body.style[i]=r,t("Body "+i+' set to "'+r+'"'))}function wr(){n===d&&(d=ot+"px");ut("margin",pr("margin",d))}function br(){document.documentElement.style.height="";document.body.style.height="";t('HTML & body height set to "auto"')}function i(n){var i={add:function(t){function i(){h(n.eventName,n.eventType)}kt[t]=i;a(window,t,i,{passive:!0})},remove:function(n){var t=kt[n];delete kt[n];ni(window,n,t)}};n.eventNames&&Array.prototype.map?(n.eventName=n.eventNames[0],n.eventNames.map(i[n.method])):i[n.method](n.eventName);t(ti(n.method)+" event listener: "+n.eventType)}function ri(n){i({method:n,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]});i({method:n,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]});i({method:n,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]});i({method:n,eventType:"Input",eventName:"input"});i({method:n,eventType:"Mouse Up",eventName:"mouseup"});i({method:n,eventType:"Mouse Down",eventName:"mousedown"});i({method:n,eventType:"Orientation Change",eventName:"orientationchange"});i({method:n,eventType:"Print",eventName:["afterprint","beforeprint"]});i({method:n,eventType:"Ready State Change",eventName:"readystatechange"});i({method:n,eventType:"Touch Start",eventName:"touchstart"});i({method:n,eventType:"Touch End",eventName:"touchend"});i({method:n,eventType:"Touch Cancel",eventName:"touchcancel"});i({method:n,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]});i({method:n,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]});i({method:n,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]});"child"===at&&i({method:n,eventType:"IFrame Resized",eventName:"resize"})}function ui(n,i,r,u){return i!==n&&(n in r||(s(n+" is not a valid option for "+u+"CalculationMethod."),n=i),t(u+' calculation method set to "'+n+'"')),n}function fi(){r=ui(r,ct,o,"height")}function ei(){u=ui(u,hr,l,"width")}function oi(){!0===e?(ri("add"),fu()):t("Auto Resize disabled")}function kr(){t("Disable outgoing messages");er=!1}function dr(){t("Remove event listener: Message");ni(window,"message",wi)}function gr(){null!==st&&st.disconnect()}function si(){ri("remove");gr();clearInterval(rr)}function nu(){kr();dr();!0===e&&si()}function tu(){var n=document.createElement("div");n.style.clear="both";n.style.display="block";document.body.appendChild(n)}function iu(){function u(){return{x:window.pageXOffset!==n?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==n?window.pageYOffset:document.documentElement.scrollTop}}function e(n){var t=n.getBoundingClientRect(),i=u();return{x:parseInt(t.left,10)+parseInt(i.x,10),y:parseInt(t.top,10)+parseInt(i.y,10)}}function i(i){function s(n){var i=e(n);t("Moving to in page link (#"+r+") at x: "+i.x+" y: "+i.y);f(i.y,i.x,"scrollToOffset")}var r=i.split("#")[1]||i,u=decodeURIComponent(r),o=document.getElementById(u)||document.getElementsByName(u)[0];n!==o?s(o):(t("In page link (#"+r+") not found in iFrame, so sending to parent"),f(0,0,"inPageLink","#"+r))}function r(){""!==location.hash&&"#"!==location.hash&&i(location.href)}function o(){function n(n){function t(n){n.preventDefault();i(this.getAttribute("href"))}"#"!==n.getAttribute("href")&&a(n,"click",t)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),n)}function h(){a(window,"hashchange",r)}function c(){setTimeout(r,ht)}function l(){Array.prototype.forEach&&document.querySelectorAll?(t("Setting up location.hash handlers"),o(),h(),c()):s("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return y.enable?l():t("In page linking not enabled"),{findTarget:i}}function ru(){t("Enable public methods");su.parentIFrame={autoResize:function(n){return!0===n&&!1===e?(e=!0,oi()):!1===n&&!0===e&&(e=!1,si()),e},close:function(){f(0,0,"close");nu()},getId:function(){return tt},getPageInfo:function(n){"function"==typeof n?(wt=n,f(0,0,"pageInfo")):(wt=function(){},f(0,0,"pageInfoStop"))},moveToAnchor:function(n){y.findTarget(n)},reset:function(){pi("parentIFrame.reset")},scrollTo:function(n,t){f(t,n,"scrollTo")},scrollToOffset:function(n,t){f(t,n,"scrollToOffset")},sendMessage:function(n,t){f(0,0,"message",JSON.stringify(n),t)},setHeightCalculationMethod:function(n){r=n;fi()},setWidthCalculationMethod:function(n){u=n;ei()},setTargetOrigin:function(n){t("Set targetOrigin: "+n);p=n},size:function(n,t){var i=""+(n?n:"")+(t?","+t:"");h("size","parentIFrame.size("+i+")",n,t)}}}function hi(){0!==c&&(t("setInterval: "+c+"ms"),rr=setInterval(function(){h("interval","setInterval: "+c)},Math.abs(c)))}function uu(){function s(n){function i(n){!1===n.complete&&(t("Attach listeners to "+n.src),n.addEventListener("load",e,!1),n.addEventListener("error",o,!1),r.push(n))}"attributes"===n.type&&"src"===n.attributeName?i(n.target):"childList"===n.type&&Array.prototype.forEach.call(n.target.querySelectorAll("img"),i)}function c(n){r.splice(r.indexOf(n),1)}function u(n){t("Remove listeners from "+n.src);n.removeEventListener("load",e,!1);n.removeEventListener("error",o,!1);c(n)}function f(t,i,r){u(t.target);h(i,r+": "+t.target.src,n,n)}function e(n){f(n,"imageLoad","Image loaded")}function o(n){f(n,"imageLoadFailed","Image load failed")}function l(n){h("mutationObserver","mutationObserver: "+n[0].target+" "+n[0].type);n.forEach(s)}function a(){var n=document.querySelector("body");return i=new v(l),t("Create body MutationObserver"),i.observe(n,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}),i}var r=[],v=window.MutationObserver||window.WebKitMutationObserver,i=a();return{disconnect:function(){"disconnect"in i&&(t("Disconnect body MutationObserver"),i.disconnect(),r.forEach(u))}}}function fu(){var n=0>c;window.MutationObserver||window.WebKitMutationObserver?n?hi():st=uu():(t("MutationObserver not supported in this browser!"),hi())}function ft(n,t){function r(n){var i,r;return/^\d+(px)?$/i.test(n)?parseInt(n,ki):(i=t.style.left,r=t.runtimeStyle.left,t.runtimeStyle.left=t.currentStyle.left,t.style.left=n||0,n=t.style.pixelLeft,t.style.left=i,t.runtimeStyle.left=r,n)}var i=0;return t=t||document.body,"defaultView"in document&&"getComputedStyle"in document.defaultView?(i=document.defaultView.getComputedStyle(t,null),i=null!==i?i[n]:0):i=r(t.currentStyle[n]),parseInt(i,ki)}function eu(n){n>w/2&&(w=2*n,t("Event throttle increased to "+w+"ms"))}function et(n,i){for(var o=i.length,f=0,e=0,s=ti(n),r=rt(),u=0;o>u;u++)f=i[u].getBoundingClientRect()[n]+ft("margin"+s,i[u]),f>e&&(e=f);return r=rt()-r,t("Parsed "+o+" HTML elements"),t("Element position calculated in "+r+"ms"),eu(r),e}function k(n){return[n.bodyOffset(),n.bodyScroll(),n.documentElementOffset(),n.documentElementScroll()]}function ci(n,t){function r(){return s("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")}var i=document.querySelectorAll("["+t+"]");return 0===i.length&&r(),et(n,i)}function li(){return document.querySelectorAll("body *")}function ai(i,e,s,h){function y(){v=c;b=a;f(v,b,i)}function p(){function t(n,t){var i=Math.abs(n-t)<=vt;return!i}return c=n!==s?s:o[r](),a=n!==h?h:l[u](),t(v,c)||g&&t(b,a)}function w(){return!(i in{init:1,interval:1,size:1})}function k(){return r in fr||g&&u in fr}function d(){t("No change in size detected")}function nt(){w()&&k()?pi(e):i in{interval:1}||d()}var c,a;p()||"init"===i?(vi(),y()):nt()}function h(n,i,r,u){function f(){n in{reset:1,resetPage:1,init:1}||t("Trigger event: "+i)}function e(){return it&&n in ou}e()?t("Trigger event cancelled: "+n):(f(),"init"===n?ai(n,i,r,u):cu(n,i,r,u))}function vi(){it||(it=!0,t("Trigger event lock on"));clearTimeout(sr);sr=setTimeout(function(){it=!1;t("Trigger event lock off");t("--")},ht)}function yi(n){v=o[r]();b=l[u]();f(v,b,n)}function pi(n){var i=r;r=ct;t("Reset trigger event: "+n);vi();yi("reset");r=i}function f(i,r,u,f,e){function o(){n===e?e=p:t("Message targetOrigin: "+e)}function s(){var s=i+":"+r,o=tt+":"+s+":"+u+(n!==f?":"+f:"");t("Sending message to host page ("+o+")");or.postMessage(nt+o,e)}!0===er&&(o(),s())}function wi(n){function e(){return nt===(""+n.data).substr(0,ur)}function u(){return n.data.split("]")[1].split(":")[0]}function i(){return n.data.substr(n.data.indexOf(":")+1)}function o(){return!("undefined"!=typeof module&&module.exports)&&"iFrameResize"in window||"jQuery"in window&&"iFrameResize"in window.jQuery.prototype}function f(){return n.data.split(":")[2]in{"true":1,"false":1}}function c(){var t=u();t in r?r[t]():o()||f()||s("Unexpected message ("+n.data+")")}function l(){!1===nr?c():f()?r.init():t('Ignored message of type "'+u()+'". Received before initialization.')}var r={init:function(){ir=n.data;or=n.source;ar();nr=!1;setTimeout(function(){tr=!1},ht)},reset:function(){tr?t("Page reset ignored by init"):(t("Page size reset by host page"),yi("resetPage"))},resize:function(){h("resizeParent","Parent window requested size check")},moveToAnchor:function(){y.findTarget(i())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var n=i();t("PageInfoFromParent called from parent: "+n);wt(JSON.parse(n));t(" --")},message:function(){var n=i();t("MessageCallback called from parent: "+n);yt(JSON.parse(n));t(" --")}};e()&&l()}function bi(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}var dt;if("undefined"!=typeof window){var e=!0,ki=10,di="",ot=0,d="",st=null,gi="",g=!1,ou={resize:1,click:1},ht=128,nr=!0,v=1,ct="bodyOffset",r=ct,tr=!0,ir="",y={},c=32,rr=null,lt=!1,nt="[iFrameSizer]",ur=nt.length,tt="",fr={max:1,min:1,bodyScroll:1,documentElementScroll:1},at="child",er=!0,or=window.parent,p="*",vt=0,it=!1,sr=null,w=16,b=1,hr="scroll",u=hr,su=window,yt=function(){s("MessageCallback function not defined")},pt=function(){},wt=function(){},bt={height:function(){return s("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return s("Custom width calculation function not defined"),document.body.scrollWidth}},kt={},cr=!1,hu=!1;try{dt=Object.create({},{passive:{get:function(){cr=!0}},once:{get:function(){hu=!0}}});window.addEventListener("test",gt,dt);window.removeEventListener("test",gt,dt)}catch(lu){}var rt=Date.now||function(){return(new Date).getTime()},o={bodyOffset:function(){return document.body.offsetHeight+ft("marginTop")+ft("marginBottom")},offset:function(){return o.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return bt.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,k(o))},min:function(){return Math.min.apply(null,k(o))},grow:function(){return o.max()},lowestElement:function(){return Math.max(o.bodyOffset()||o.documentElementOffset(),et("bottom",li()))},taggedElement:function(){return ci("bottom","data-iframe-height")}},l={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return bt.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(l.bodyScroll(),l.documentElementScroll())},max:function(){return Math.max.apply(null,k(l))},min:function(){return Math.min.apply(null,k(l))},rightMostElement:function(){return et("right",li())},taggedElement:function(){return ci("right","data-iframe-width")}},cu=lr(ai);a(window,"message",wi);a(window,"readystatechange",bi);bi()}}()