typeof jQuery=="undefined"&&console.error("GREATER.Widgetworks - jQuery not found");var GREATER=GREATER||{},_wiwo=_wiwo||[];GREATER.Widgetworks=GREATER.Widgetworks||{initialised:!1,initCtaEvents:function(){_wiwo.push(["on","eventTrack",function(n,t){t.action=="call-to-action"&&_wiwo.push(["postMessage",n.frameId,"wiwo.dido.getData"])}]);_wiwo.push(["on","wiwo.dido.getDataResult",function(n,t){var i,u,a,r,v,h,p,f,w,e,c,l,y;if(t.success){if(i={},u=t.data,console.log("Received data from Widgetworks widget: "+n.frameId,u),a=n.frame.dataset.redirectUrl,a&&a!==""){console.log("Redirecting to "+a);top.location=a;return}switch(u.id){case"wiwo-repayment-widget":r=u.input.repaymentModel;v=u.input.savingsModel;h=u.output.repaymentResultModel;p=u.output.savingsResultModel;i["Property Value"]=r.propertyValue;i["Loan Amount"]=r.principal;i["House Purpose"]=r.productGroup;i["Home Loan Product"]=r.product;i["Loan Term"]=r.principal;i["Interest Rate"]=r.interestRate;i["Repayment Frequency"]=r.repaymentFrequency;i["Repayment Type"]=r.repaymentType;i["Extra Repayment Amount"]=v.extraRepayment;i["Extra Repayment Frequency"]=v.repaymentFrequency;i["Offset Account Amount"]=v.offset;i["Lump Sum Amount"]=v.lumpSum;i["Result - Repayment Amount"]=h.totalLoanAmount;i["Result - Total Interest Payable"]=h.totalInterestPayable;i["Result - Interest Saved"]=p.interestSaved;i["Result - Time Saved"]=p.timeSavedFormatted;break;case"wiwo-borrowing-power":for(f=u.dataList[0].input.borrowingRequestModel,w=u.dataList[0].output,r=u.dataList[1].input.repaymentModel,h=u.dataList[1].output.repaymentResultModel,i["Application Type"]=f.applicationType,i.Dependants=f.dependants,i["Applicant 1 income amount"]=f.applicantList[0].incomeList[0].income,i["Applicant 1 income frequency"]=f.applicantList[0].incomeList[0].incomeFrequency,i["Applicant 2 income amount"]=f.applicantList[1].incomeList[0].income,i["Applicant 2 income frequency"]=f.applicantList[1].incomeList[0].incomeFrequency,e=1;e<f.applicantList[0].incomeList.length;e++)i["Other income type "+e]=f.applicantList[0].incomeList[e].incomeCategory,i["Other income amount "+e]=f.applicantList[0].incomeList[e].income,i["Other income frequency "+e]=f.applicantList[0].incomeList[e].incomeFrequency;i["Monthly living expenses"]=f.expenseModel.livingExpenseMonthly;i["Total monthly repayments on loans"]=f.expenseModel.loanExpenseMonthly;i["Total of all credit card limits"]=f.expenseModel.creditCardLimit;i["Result - Borrowing Power"]=w.borrowingPowerMaximum;i.Repayments=h.chartSeries.lastTerm;i["Property Value"]=r.propertyValue;i["Loan Amount"]=h.totalLoanAmount;i["House Purpose"]=r.productGroup;i["Home Loan Product"]=r.product;i["Loan Term"]=r.term;i["Interest Rate"]=r.interestRate;i["Repayment Frequency"]=r.repaymentFrequency;i["Repayment Type"]=r.repaymentType;i["Result - Repayment Amount"]=r.totalLoanAmount;i["Result - Total Interest Payable"]=r.totalInterestPayable;break;case"wiwo-loan-comparison":var o=u.input.loans[0],b=u.output.loanResults[0],s=u.input.loans[1],k=u.output.loanResults[1];i["Loan 1 - Property Value"]=o.repaymentModel.propertyValue;i["Loan 1 - Loan Amount"]=o.repaymentModel.principal;i["Loan 1 - Loan Term"]=o.repaymentModel.term;i["Loan 1 - Property purpose"]=o.repaymentModel.productGroup;i["Loan 1 - Product"]=o.repaymentModel.product;i["Loan 1 - Interest Rate"]=o.repaymentModel.interestRate;i["Loan 1 - Extra Repayment"]=o.savingsModel.extraRepayment;i["Loan 1 Result - Repayment"]=b.repaymentResultModel.totalLoanAmount;i["Loan 1 Result - Total Interest Payable"]=b.repaymentResultModel.totalInterestPayable;i["Loan 2 - Property Value"]=s.repaymentModel.propertyValue;i["Loan 2 - Loan Amount"]=s.repaymentModel.principal;i["Loan 2 - Loan Term"]=s.repaymentModel.term;i["Loan 2 - Property purpose"]=s.repaymentModel.productGroup;i["Loan 2 - Product"]=s.repaymentModel.product;i["Loan 2 - Interest Rate"]=s.repaymentModel.interestRate;i["Loan 2 - Extra Repayment"]=s.savingsModel.extraRepayment;i["Loan 2 Result - Repayment"]=k.repaymentResultModel.totalLoanAmount;i["Loan 2 Result - Total Interest Payable"]=k.repaymentResultModel.totalInterestPayable;break;case"wiwo-stampduty":c=u.input.sdStateModel.dutyModels[0].inputModel;l=u.input.sdStateModel.dutyModels[0].stampDutyResult;i["State/Territory"]=c.propertyState;i["Property Value"]=c.purchasePrice;i["Property Purpose"]=c.propertyPurpose;i["Property Type"]=c.firstHomeType;i["First Home Buyer"]=c.firstHomeBuyer;i["Result - Fees and charges"]=l.totalGovtFees;i["Result - Mortgage Registration Fee"]=l.mortgageRegistrationFee;i["Result - Transfer Fee"]=l.landTransferFee;i["Result - Title Search Fee"]=l.titleSearchFee;i["Result - Stamp Duty"]=l.stampDuty}console.log(i);y=$(".block-genericcontactformblock").last();y.length?(y.find('input[name="Comment"]').val(JSON.stringify(i)),console.log("GenericContactFormBlock comment field updated with widget values."),y.show(),$("html, body").animate({scrollTop:y.offset().top},1e3)):console.log("GenericContactFormBlock not found")}else console.log("Unable to get data from Widgetworks widget: "+n.frameId,t.message)}])},initAnalyticsTracking:function(){function n(n){return t[n]||"Unknown Calculator: "+n}if(typeof ga=="undefined"&&typeof dataLayer=="undefined"){console.error("Google Analytics and Tag Manager not available at GREATER.Widgetworks.initAnalyticsTracking");return}var t={"wiwo-bunajipu":"Borrowing Power","wiwo-bugiyotsu":"Budget Planner","wiwo-daduyazo":"Deposit Planner","wiwo-bijipaha":"Income Tax","wiwo-hokoya":"Key Facts Sheet","wiwo-bokodapu":"Loan Comparison","wiwo-bihopese":"Personal Loan","wiwo-bekatego":"Mortgage Repayment","wiwo-hezape":"Stamp Duty"};typeof dataLayer!="undefined"&&(_wiwo.push(["on","pageTrack",function(t,i){dataLayer.push({event:"wiwoPageTrack",eventDim1:n(t.frameId),eventWiwoPath:i})}]),_wiwo.push(["on","eventTrack",function(t,i){var r=i.value==null?void 0:i.value;dataLayer.push({event:"wiwoCalcEvent",eventDim1:n(t.frameId),eventCategory:i.category,eventAction:i.action,eventLabel:i.label,eventValue:r})}]));typeof ga!="undefined"&&(_wiwo.push(["on","pageTrack",function(t,i){ga("set","dimension1",n(t.frameId));ga("send","pageview",i)}]),_wiwo.push(["on","eventTrack",function(t,i){var r=i.value==null?void 0:i.value;ga("set","dimension1",n(t.frameId));ga("send","event",i.category,i.action,i.label,r)}]))},init:function(){if(this.initialised)return!1;this.initialised=!0;location.hostname==="www.greater.com.au"&&(console.log=function(){});var n=(new Date).getTime();return this.initCtaEvents(),this.initAnalyticsTracking(),console.log("GREATER.Widgetworks init completed: "+((new Date).getTime()-n)+"ms"),this}};GREATER.Widgetworks.init()