function initPhonePlans(){$.OptusHandsetCarousel({urlparams:[{name:"student",value:"true"},{name:"code",value:studentCoupon},{name:"key",value:hashKey}],propType:"consumer",initPaymentType:"lease",paymentType:"lease",templateSelector:"#contentTemplate",callback:function(){$(window).width()<=500?$(".plan-slider .swiper-container .swiper-button-next").click().click().click().click():$(".plan-slider .swiper-container .swiper-button-next").click().click()},development:development,pageConfig:pageConfig})}function initBYOPlans(){var e=[{name:"student",value:"true"},{name:"edge",value:prezzee},{name:"code",value:studentCoupon},{name:"key",value:hashKey}];$.OptusHandsetCarousel({carousel:"byo",urlparams:e,propType:"consumer",templateSelector:"#contentTemplate-byo",development:development,planIdx:2,callback:function(){$(window).width()<=500&&$(".plan-slider .swiper-container .swiper-button-next").click()},pageConfig:pageConfig})}function toggleStickyHeader(){var e=$(".plan-type-toggle").offset().top;$(window).scrollTop()>=e?$(".plan-type-toggle").addClass("sticky"):$(".plan-type-toggle").removeClass("sticky")}var dataCache={byo:null,handset:null};!function(e){var t={init:function(){e("#svod .tab_content").hide(),e("#svod ul.tabs li").on("click",function(){e(this).hasClass("active")?(e("#svod .tab_content").hide(),e("#"+t.init.activeTab).fadeOut(),e(this).removeClass("active"),e("#svod .tab_drawer_heading").addClass("d_active"),e("#svod .tab_drawer_heading[rel^='"+t.init.activeTab+"']").removeClass("d_active"),t.initSlider()):(e("#svod .tab_content").hide(),t.init.activeTab=e(this).attr("rel"),e("#"+t.init.activeTab).fadeIn(),e("#svod ul.tabs li").removeClass("active"),e(this).addClass("active"),t.initSlider())}),e("#svod .tab_drawer_heading").on("click",function(){e(this).hasClass("d_active")?(e("#svod .tab_content").hide(),t.init.activeTab=e(this).attr("rel"),e("#"+t.init.activeTab).fadeOut(),e("#svod .tab_drawer_heading").removeClass("d_active"),t.initSlider()):(e("#svod .tab_content").hide(),t.init.activeTab=e(this).attr("rel"),e("#"+t.init.activeTab).fadeIn(),e("#svod .tab_drawer_heading").removeClass("d_active"),e(this).addClass("d_active"),e("#svod ul.tabs li").removeClass("active"),e("#svod ul.tabs li[rel^='"+t.init.activeTab+"']").addClass("active"),t.initSlider())});ractiveHandsetCarousel.get("page")},initSlider:function(){new Swiper(".music-streaming-slick .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,nextButton:".music-streaming-slick .swiper-container .swiper-button-next",prevButton:".music-streaming-slick .swiper-container .swiper-button-prev",pagination:".music-streaming-slick .swiper-container .swiper-pagination",breakpoints:{6e3:{slidesPerView:3,spaceBetween:10},800:{slidesPerView:1}}}),new Swiper(".mobile-tv-slick .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,nextButton:".mobile-tv-slick .swiper-container .swiper-button-next",prevButton:".mobile-tv-slick .swiper-container .swiper-button-prev",pagination:".mobile-tv-slick .swiper-container .swiper-pagination",breakpoints:{6e3:{slidesPerView:4,spaceBetween:10,slidesPerGroup:4},800:{slidesPerView:1,slidesPerGroup:1}}}),new Swiper(".optus-sport-slick .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,centeredSlides:!0,nextButton:".optus-sport-slick .swiper-container .swiper-button-next",prevButton:".optus-sport-slick .swiper-container .swiper-button-prev",pagination:".optus-sport-slick .swiper-container .swiper-pagination",breakpoints:{6e3:{slidesPerView:4,spaceBetween:10},800:{slidesPerView:1,slidesPerGroup:1}}})}},a=!1;e.OptusHandsetCarousel=function(s){function o(a){e("#spinner").hide(),e(".plan-type-toggle a.active").length>0&&e("#hcpm").show(),"new"==s.customerType?(e(".filter.customer_type").addClass("hide"),e(".filter-option.new_or_existing_new").addClass("active")):"existing"==s.customerType?(e(".filter.customer_type").removeClass("hide"),e(".filter-option.new_or_existing_new").removeClass("active"),e(".filter-option.new_or_existing_existing").addClass("active"),e(".ux-radio-button input[type=radio][value=existing]").prop("checked","checked")):"p2p"==s.customerType&&(e(".filter.customer_type").removeClass("hide"),e(".filter-option.new_or_existing_new").removeClass("active"),e(".filter-option.new_or_existing_existing").addClass("active"),e(".ux-radio-button input[type=radio][value=p2p]").prop("checked","checked"));var o=y(a.handsets,s.heroHandsets);"postpaid-mobile"===s.carousel&&(o=p(o,s.campaignHandsets)),o[0].skus=o[0].skus,o[0].storage=o[0].storage;var n=d(s.selectedSku.storage,s.selectedSku.colour,o[0])||o[0].skus[0];o[0].colours=g(n.storage,o[0]);var r=[];r="buy"==s.paymentType?k(o[0].buyPlanList,a.plans.postpaid):k(o[0].leasingPlanList,a.plans.leasing);var l={};l=""!=s.recommendPlan?O(s.recommendPlan,r):r[0],ractiveHandsetCarousel.set({handsets:o,selectHandset:o[0],selectSku:n,plans:r,rawPlans:a.plans,rawBoltons:a.boltons,recommendPlan:l}),"byo"===s.carousel&&(r=a.plans.byo,ractiveHandsetCarousel.set({plans:a.plans.byo,contractLengthFilter:s.contractLength,flybuysMapping:a.flybuysMapping})),"buy"==s.paymentType?e(".leasing_copy").addClass("hide"):e(".leasing_copy").removeClass("hide"),ractiveHandsetCarousel.set("bannerOffers",P(r,o[0]));new Swiper(".banner-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,allowSwipeToPrev:!1,allowSwipeToNext:!1,nextButton:".banner-slider .swiper-container .swiper-button-next",prevButton:".banner-slider .swiper-container .swiper-button-prev",slidesPerView:1});if("postpaid-mobile"===s.carousel){new Swiper(".phone-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,nextButton:".phone-slider .swiper-container .swiper-button-next",prevButton:".phone-slider .swiper-container .swiper-button-prev",pagination:".phone-slider .swiper-container .swiper-pagination",breakpoints:{6e3:{slidesPerView:4,spaceBetween:10,slidesPerGroup:4},860:{slidesPerView:3,spaceBetween:10,slidesPerGroup:2},500:{slidesPerView:1,spaceBetween:10,slidesPerGroup:1}}})}L=new Swiper(".plan-slider .swiper-container",{grabCursor:!0,observer:!0,centeredSlides:!1,nextButton:".plan-slider .swiper-container .swiper-button-next",prevButton:".plan-slider .swiper-container .swiper-button-prev",pagination:".plan-slider .swiper-container .swiper-pagination",initialSlide:parseInt(s.planIdx),breakpoints:{6e3:{slidesPerView:3.5,spaceBetween:10},1150:{slidesPerView:2.65,spaceBetween:10},860:{slidesPerView:2.25,spaceBetween:10},500:{slidesPerView:1,spaceBetween:10}}}),"byo"==s.carousel&&(dataCache.byo=a),"postpaid-mobile"==s.carousel&&(dataCache.handset=a),s.callback(),e("*[data-scrollto]").click(function(t){t.preventDefault();var a=e(this).data("scrollto");if($target=e('*[data-scrollto_target="'+a+'"]'),$target.length>0){$target.is(".accordion-item-caption")&&$target.closest("li").is(":not(.active)")&&$target.trigger("click");e("html, body").animate({scrollTop:$target.offset().top-200},300)}}),e("#r-86").on("toggled",function(t,a){var s=a.parent();e("html, body").animate({scrollTop:s.offset().top-0},350)}),e(document).foundation(),e(document).foundation("tab","reflow"),t.init(),e(document).on("opened.fndtn.reveal","[data-reveal]",function(){A=new Swiper(".fetch-channel-lightbox .swiper-container",{grabCursor:!0,nextButton:".fetch-channel-lightbox .swiper-button-next",prevButton:".fetch-channel-lightbox .swiper-button-prev",slidesPerView:1})}),setTimeout(function(){c()},50)}function n(e,t){if("byo"==s.carousel)var o="byo";else var o="handsetplans";var n=ractiveHandsetCarousel.get("selectSku");if(s.pageConfig)if("slugs"in s.pageConfig.plans[o]){for(var r=s.pageConfig.plans[o].skus,l=0;l<r.length;l++)if(r[l].id==n.id){for(var i=0;i<r[l].plans.plus.length;i++)if(r[l].plans.plus[i].id==e)return r[l].plans.plus[i];for(var i=0;i<r[l].plans.flex.length;i++)if(r[l].plans.flex[i].id==e)return r[l].plans.flex[i];r[l].location?(r[l].location.flex?a=r[l].location.flex:r[l].location.plus&&(a=r[l].location.plus),a=parseInt(a)):a=!1}handsets=s.pageConfig.plans[o].slugs;for(var l=0;l<handsets.length;l++){var r=handsets[l];if(r.id==t.slug){for(var i=0;i<r.plans.plus.length;i++)if(r.plans.plus[i].id==e)return r.plans.plus[i];for(var i=0;i<r.plans.flex.length;i++)if(r.plans.flex[i].id==e)return r.plans.flex[i]}}}else for(var c=s.pageConfig.plans[o],l=0;l<c.length;l++)if(c[l].id==e)return c[l];return!1}function r(e,t,a){var o=n(e,a);return o&&t in o?o[t]:!!s.pageConfig.page[t]&&s.pageConfig.page[t]}function l(t,a){e.each(t,function(e,t){t.defaultValue&&(a.push(t),t.added=!0)})}function i(t,a){return t=e.grep(t,function(e,t){return e.id!=a.id&&e.groupChild!=a.compID||(e.added=!1),e.id!==a.id&&e.groupChild!==a.compID})}function c(){for(var t=[".plan-header",".feature.PO_Included_Data",".feature.PO_Business_Care",".feature.PO_Included_Calls_Text",".feature.PO_Included_int",".feature.PO_Included_roaming",".feature.PO_Included_Entertainment",".plan-footer",".feature.bundle",".feature.PO_save",".feature.PO_onemonth"],a=0;a<t.length;a++){var s=0;e(t[a]).each(function(){e(this).css("height","auto"),e(this).height()>s&&(s=e(this).height())}),e(t[a]).each(function(){e(this).height(s)})}}function d(e,t,a){if(""!=e&&""==t){e=parseInt(e.substring(0,e.toLowerCase().indexOf("gb")));var s=g(e,a);s.length>0&&(t=s[0].colour)}else if(""==e&&""!=t){var o=v(t,a);e=o[0]}else _.isString(e)&&(e=parseInt(e.substring(0,e.toLowerCase().indexOf("gb"))));for(var n=0;n<a.skus.length;n++)if(a.skus[n].storage===e&&a.skus[n].colour.toLowerCase().replace(" ","")===t.toLowerCase().replace(" ",""))return a.skus[n]}function u(e){for(var t=ractiveHandsetCarousel.get("handsets"),a=0;a<t.length;a++)if(t[a].name.toLowerCase()===e.name.toLowerCase())return a}function p(e,t){var a=[];if(t.length>0){for(var s=0;s<e.length;s++)for(var o=0;o<t.length;o++)if(t[o].toLowerCase()==e[s].name.toLowerCase()){a.push(e[s]);break}}else a=e;return a}function f(e){for(var t=[],a=0;a<e.skus.length;a++)-1==t.indexOf(e.skus[a].storage)&&t.push(e.skus[a].storage);return t}function v(e,t){for(var a=[],s=0;s<t.skus.length;s++)t.skus[s].colour.toLowerCase().replace(" ","")===e.toLowerCase().replace(" ","")&&a.push(t.skus[s].storage);return a}function g(e,t){for(var a=[],s=0;s<t.skus.length;s++)if(t.skus[s].storage===e){var o={};o.colour=t.skus[s].colour.toLowerCase(),o.imageColour=t.skus[s].imageColour,o.listImage=t.skus[s].listImage,o.proImage=t.skus[s].proImage,o.colorIndex=t.skus[s].colorIndex,a.push(o)}return a.sort(function(e,t){return e.colorIndex>t.colorIndex?1:-1}),a}function m(){var e=ractiveHandsetCarousel.get("selectPlan");if(""!=e.plan){var t=ractiveHandsetCarousel.get("summary"),a=ractiveHandsetCarousel.get("selectHandset"),o=ractiveHandsetCarousel.get("customerType"),n=ractiveHandsetCarousel.get("selectSku"),l=x(e.plan,a.name,o);t.monthlyCost=l.disPlanCost,t.originalMonthlyCost=l.planCost;var i=r(e.plan.id,"discount",ractiveHandsetCarousel.get("selectHandset")),c=(ractiveHandsetCarousel.get("secondServiceAdded"),ractiveHandsetCarousel.get("customerType"));i.percent?(s.offerDiscount=i.percent,"postpaid-mobile"===s.carousel||"byo"===s.carousel&&"existing"!=c?t.monthlyCost=t.monthlyCost*((100-s.offerDiscount)/100):t.monthlyCost=1*t.monthlyCost,e.plan.percent_discount=i.percent,ractiveHandsetCarousel.set("selectPlan",e)):i.dollar&&(t.monthlyCost=t.monthlyCost,e.plan.dollar_discount=s.dollarDiscount,ractiveHandsetCarousel.set("selectPlan",e));var d=e.plan.position-1;"plus"===e.plan.planType?t.handsetCost=n.mro.postpaid[d]:"flex"===e.plan.planType?t.handsetCost=n.mro.leasing[d]:t.handsetCost=0;var u=0,p=0;_.each(e.selectedBoltons,function(t){if("MONTHLY"===t.costType)if("YES_STREAMING_MOB_5"==t.id){var a=ractiveHandsetCarousel.get("page");"byo"==e.plan.planType&&"10229"==e.plan.id&&"stu"==a&&"existing"!=c?u=u:u+=t.cost}else u+=t.cost;else p+=t.cost}),t.totalMonthlyExtraCost=u,t.totalUpfrontFeeCost=p,t.totalMonthlyCost=t.monthlyCost+t.totalMonthlyExtraCost+t.handsetCost,t.mtc=t.totalMonthlyCost*e.plan.contractLength+t.totalUpfrontFeeCost,1==ractiveHandsetCarousel.get("secondServiceAdded")&&(t.totalMonthlyCost+=15,t.mtc+=180),ractiveHandsetCarousel.set("summary",t)}}function C(e){for(var t="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",s=0;s<e;s++)t+=a.charAt(Math.floor(Math.random()*a.length));return t}function h(){var e="https://offer.optus.com.au/rebuild/offline/";s.development||(e="https://offer.optus.com.au/offlineform/");var t=ractiveHandsetCarousel.get("selectSku"),a=ractiveHandsetCarousel.get("selectPlan"),o=ractiveHandsetCarousel.get("customerType"),n=ractiveHandsetCarousel.get("student"),l=ractiveHandsetCarousel.get("selectHandset"),i=ractiveHandsetCarousel.get("page"),c=ractiveHandsetCarousel.get("isWatchAdded");ractiveHandsetCarousel.get("summary");if(e+="new"===o?"shoppingcart?action=addToCart":"p2p"===o?"shoppingcart?action=pre2Post":"existing"===o?"upgrade?action=addToCart&":"shoppingcart?action=addToCart",e+="&resourceId="+t.id,e+="&externalPackageId="+a.plan.id,e+="&resourceCL="+a.plan.contractLength,"BYO-Handset"===t.id?e+="&colorId=BYO-Handset":e+="&colorId=",a.selectedBoltons.length>0||s.boltons.length>0||boltonHack||"epl"==i||("fbreg"==i||"fbmetro"==i)&&("10227"==a.plan.id||"10228"==a.plan.id||"10229"==a.plan.id)){boltons="&boltonIds=";for(var d=0;d<a.selectedBoltons.length;d++)boltons+=a.selectedBoltons[d].compID+",";for(var d=0;d<s.boltons.length;d++)boltons+=s.boltons[d]+",";"fbreg"!=i&&"fbmetro"!=i||"10227"!=a.plan.id||(boltons+="11424,");var u=r(a.plan.id,"discount",l);boltons+=u?u.bolton_id+",":s.pageConfig.page.discount.bolton_id+",","ptr"==i&&"10229"==a.plan.id&&(boltons+="31687,"),"stu"==i&&"10229"==a.plan.id&&"existing"!=o&&(boltons+="31687,"),"existing"===o&&"10229"==a.plan.id&&(boltons=boltons.replace("30356","")),boltons=boltons.slice(0,-1),e+=boltons}e+="&productOfferingCL="+a.plan.contractLength;for(var d=0;d<s.urlparams.length;d++)e+="&"+s.urlparams[d].name+"="+s.urlparams[d].value;return e+="&ctype="+s.propType,!0===n&&(e+="&student=true"),"10229"==a.plan.id||"10206"==a.plan.id?e+="&studentoffer=true":e+="&studentoffer=false",c&&(e+="&visa=Samsung-GS9-tab-a-bundle"),e+="&tactical="+T(a.plan,l.name,o),1==ractiveHandsetCarousel.get("secondServiceAdded")&&(e+="&accessory=second-service"),e}function b(){var e="https://www.optus.com.au/";s.development||(e="https://www.optus.com.au/");var t=ractiveHandsetCarousel.get("selectSku"),a=ractiveHandsetCarousel.get("selectPlan"),o=ractiveHandsetCarousel.get("customerType"),n=ractiveHandsetCarousel.get("page"),r="shop/shoppingcart?action=addToCart&resourceId=";"new"===o?r="smb"===s.propType?"business/shoppingcart?action=onlineOfflineOrder&resourceId=":"shop/shoppingcart?action=addToCart&resourceId=":"p2p"===o?r="shop/shoppingcart?action=pre2Post&resourceId=":"existing"===o&&(r="smb"===s.propType?"business/upgrade?action=addToCart&resourceId=":"shop/upgrade?action=addToCart&resourceId="),e+=r+t.id,e+="&resourceCL="+a.plan.contractLength,"BYO-Handset"===t.id?e+="&colorId=BYO-Handset":e+="&colorId=",e+="&externalPackageId="+a.plan.id,e+="&productOfferingCL="+a.plan.contractLength;var l=(new Date).getTime();if(l=C(1)+Math.floor(1e3*Math.random()).toString()+l,e+="&atcid="+l,a.selectedBoltons.length>0||s.boltons.length>0||boltonHack||"spring"==n){boltons="&boltonIds=";for(var i=0;i<a.selectedBoltons.length;i++)boltons+=a.selectedBoltons[i].compID+",";for(var i=0;i<s.boltons.length;i++)boltons+=s.boltons[i]+",";"spring"==n&&(boltons+="30892,"),"mnt"!=n&&"rec_cmr"!=n&&"rec_smb"!=n||85!=a.plan.value&&105!=a.plan.value&&125!=a.plan.value||(boltons+="11424,"),boltons=boltons.slice(0,-1),e+=boltons}for(var i=0;i<s.urlparams.length;i++)e+="&"+s.urlparams[i].name+"="+s.urlparams[i].value;return 1==ractiveHandsetCarousel.get("secondServiceAdded")&&(e+="&accessory=second-service"),e}function w(t){var a=e(".product-selector-sticky-header"),s=0;a.length>0&&(s=a.height()),e("html, body").animate({scrollTop:e(t).offset().top-s},350)}function y(e,t){if(t)for(var a=0;a<t.length;a++)for(var s=0;s<e.length;s++)if(e[s].name===t[a]){var o=e[s];e.splice(s,1),e.splice(a,0,o)}return e}function H(e,t){return e<t?-1:e>t?1:0}function x(t,a,s){var o=t.value,n=o,r=ractiveHandsetCarousel.get("page"),l=[],i=!1,c=[],d=!1,u={};if(t.tacticalOffer){for(var p=[],f=[],v=0;v<t.tacticalOffer.length;v++)"discount(%)"===t.tacticalOffer[v].offerType?f.push(v):"discount($)"===t.tacticalOffer[v].offerType&&p.push(v);if(p.length>0)for(var g in p){var m=e.inArray(p[g],p);if(m>=0){l.length=0,i=!1,l=t.tacticalOffer[p[g]].offerPage.split("|");for(var C in l){var h=e.inArray(l[C],l);h>=0&&r.toLowerCase()===l[C].trim().toLowerCase()&&(i=!0)}if((""==t.tacticalOffer[p[g]].offerCustomerType||t.tacticalOffer[p[g]].offerCustomerType==s)&&i&&a){d=!1,c.length=0,c=t.tacticalOffer[p[g]].offerDeviceList.split("|");for(var b in c){var h=e.inArray(c[b],c);h>=0&&a.toLowerCase()===c[b].trim().toLowerCase()&&(d=!0)}n="all"===t.tacticalOffer[p[g]].offerDeviceRange?o-t.tacticalOffer[p[g]].offervalue:"excluded"!==t.tacticalOffer[p[g]].offerDeviceRange||d?"included"===t.tacticalOffer[p[g]].offerDeviceRange&&d?o-t.tacticalOffer[p[g]].offervalue:o:o-t.tacticalOffer[p[g]].offervalue}}}if(f.length>0)for(var g in f){var w=e.inArray(f[g],f);if(w>=0){l.length=0,i=!1,l=t.tacticalOffer[f[g]].offerPage.split("|");for(var C in l){var h=e.inArray(l[C],l);h>=0&&r.toLowerCase()===l[C].trim().toLowerCase()&&(i=!0)}if((""==t.tacticalOffer[f[g]].offerCustomerType||t.tacticalOffer[f[g]].offerCustomerType==s)&&i&&a){d=!1,c.length=0,c=t.tacticalOffer[f[g]].offerDeviceList.split("|");for(var b in c){var h=e.inArray(c[b],c);h>=0&&a.toLowerCase()===c[b].trim().toLowerCase()&&(d=!0)}n="all"===t.tacticalOffer[f[g]].offerDeviceRange?o*(100-t.tacticalOffer[f[g]].offervalue)/100:"excluded"!==t.tacticalOffer[f[g]].offerDeviceRange||d?"included"===t.tacticalOffer[f[g]].offerDeviceRange&&d?o*(100-t.tacticalOffer[f[g]].offervalue)/100:o:o*(100-t.tacticalOffer[f[g]].offervalue)/100}}}}return u.planCost=parseFloat(o),u.disPlanCost=parseFloat(n),u}function T(e,t,a){var s="",o=ractiveHandsetCarousel.get("page"),n=[],r=!1,l=[],i=!1;if(e.tacticalOffer){for(var c=0;c<e.tacticalOffer.length;c++){if(n.length=0,r=!1,e.tacticalOffer[c].offerPage.indexOf("|")>=0){n=e.tacticalOffer[c].offerPage.split("|");for(var d in n)o.toLowerCase()===n[d].trim().toLowerCase()&&(r=!0)}else o.toLowerCase()===e.tacticalOffer[c].offerPage.trim().toLowerCase()&&(r=!0);if((""==e.tacticalOffer[c].offerCustomerType||e.tacticalOffer[c].offerCustomerType==a)&&r){if(i=!1,l.length=0,l=e.tacticalOffer[c].offerDeviceList.split("|"),t)for(var u in l)t.toLowerCase()===l[u].trim().toLowerCase()&&(i=!0);"all"===e.tacticalOffer[c].offerDeviceRange?s+=e.tacticalOffer[c].id+",":"excluded"!==e.tacticalOffer[c].offerDeviceRange||i?"included"===e.tacticalOffer[c].offerDeviceRange&&i&&(s+=e.tacticalOffer[c].id+","):s+=e.tacticalOffer[c].id+","}}s=s.slice(0,-1)}return s}function P(e,t){var a=e[0],s=t.name,o=ractiveHandsetCarousel.get("customerType"),n=ractiveHandsetCarousel.get("page"),r=[],l=[],i=!1,c=[],d=!1;if(a.tacticalOffer.length>0)for(var u=0;u<a.tacticalOffer.length;u++)if("banner"===a.tacticalOffer[u].offerType){l.length=0,i=!1,l=a.tacticalOffer[u].offerPage.split("|");for(var p in l)n.toLowerCase()===l[p].trim().toLowerCase()&&(i=!0);if((""==a.tacticalOffer[u].offerCustomerType||a.tacticalOffer[u].offerCustomerType==o)&&i){d=!1,c.length=0,c=a.tacticalOffer[u].offerDeviceList.split("|");for(var f in c)s.toLowerCase()===c[f].trim().toLowerCase()&&(d=!0);"all"===a.tacticalOffer[u].offerDeviceRange?r.push(a.tacticalOffer[u]):"excluded"!==a.tacticalOffer[u].offerDeviceRange||d?"included"===a.tacticalOffer[u].offerDeviceRange&&d&&r.push(a.tacticalOffer[u]):r.push(a.tacticalOffer[u])}}return r}function k(t,a){var s=[];return t.length>0&&e.each(a,function(e,a){t.indexOf(a.id)>-1&&s.push(a)}),s}function O(t,a){var s={};return e.each(a,function(e,a){a.id===t&&(s=a)}),s}function S(e,t,a,s,o){ga("optus.send",{hitType:e,eventCategory:t,eventAction:a,eventLabel:s,eventValue:o})}Ractive.DEBUG=!1;var $=Ractive.defaults.data;$.isSuggestedPlan=function(e){var t=(ractiveHandsetCarousel.get("selectHandset").name,ractiveHandsetCarousel.get("customerType")),a=r(e,"hero",ractiveHandsetCarousel.get("selectHandset"));if(("postpaid-mobile"===s.carousel||"byo"===s.carousel&&"existing"!=t)&&a)return!0},$.isExistingCustomer=function(){if("existing"==ractiveHandsetCarousel.get("customerType"))return!0},$.hasTactical=function(e,t){return e.tacticalOfferID.toLowerCase().indexOf(t.toLowerCase())>-1},$.isSuggestedPlanDescription=function(e){var t=(ractiveHandsetCarousel.get("selectHandset").name,ractiveHandsetCarousel.get("customerType")),a=r(e,"badge",ractiveHandsetCarousel.get("selectHandset"));if(("postpaid-mobile"===s.carousel||"byo"===s.carousel&&"existing"!=t)&&a)return a},$.isShow=function(e,t,a,o){return s.pageConfig?!!n(e,ractiveHandsetCarousel.get("selectHandset")):"10140"!=e&&"10142"!=e||"Samsung Galaxy Note9"!=t||128==a},$.offerDiscountSet=function(e,t,a){var o=r(e,"discount",ractiveHandsetCarousel.get("selectHandset")),n=ractiveHandsetCarousel.get("customerType");if("postpaid-mobile"===s.carousel||"byo"===s.carousel&&"existing"!=n)return o?o.percent:s.pageConfig.page.discount.percent};var B={development:!1,carousel:"postpaid-mobile",heroHandsets:[],campaignHandsets:[],heroPlans:null,urlparams:[],extraInclusions:"",propType:"consumer",excludedPlans:[],personalisedOffer:"",offerDiscount:0,dollarDiscount:0,customerToggle:!0,customerType:"new",contractToggle:!0,contractLength:12,selectedSku:{colour:"",storage:""},boltons:[],layout:"iphone",recommendPlan:"",initPaymentType:"",paymentType:"buy",planIdx:"0",templateSelector:"#contentTemplate",callback:function(){}},s=e.extend({},B,s);s.pageConfig&&(s.page=s.pageConfig.page.id,s.offerDiscount=s.pageConfig.page.discount.percent,s.dollarDiscount=s.pageConfig.page.discount.dollar),ractiveHandsetCarousel=new Ractive({el:"#contentContainer",template:s.templateSelector,data:{carouselType:s.carousel,offerDiscount:s.offerDiscount,dollarDiscount:s.dollarDiscount,propType:s.propType,initPaymentType:s.initPaymentType,page:s.page,paymentType:s.paymentType,customerType:s.customerType,contractToggle:s.contractToggle,customerToggle:s.customerToggle,contractLengthFilter:s.contractLength,recommendPlanID:s.recommendPlan,recommendPlan:{},handsets:[],rawPlans:{},plans:[],selectHandset:{},selectSku:{},selectPlan:{plan:"",boltons:"",boltonGroup:"",selectedBoltons:""},isWatchAdded:!1,student:!1,prePlanType:"ultimate",summary:{monthlyCost:0,handsetCost:0,totalMonthlyCost:0,totalMonthlyExtraCost:0,totalUpfrontFeeCost:0,mtc:0},bannerOffers:[],pageConfig:s.pageConfig,format:function(e){return e=parseFloat(e),e%1!=0?e.toFixed(2):e},getMonthlyPlanCost:function(e){var t=this.get("plans."+e),a=this.get("selectHandset").name,s=this.get("customerType"),o=x(t,a,s);return o},getHandsetCost:function(e){var t=this.get("plans."+e),a=this.get("selectSku"),s=0;return s="plus"===t.planType?a.mro.postpaid[t.position-1]:"flex"===t.planType?a.mro.leasing[t.position-1]:0,parseFloat(s)},getBonusData:function(e){var t=this.get("plans."+e),a=this.get("selectHandset").name,s=this.get("customerType"),o=this.get("page"),n=!1,r=[],l=!1,i=[],c=!1;if(t.tacticalOffer)for(var d=0;d<t.tacticalOffer.length;d++)if("bonus_data"===t.tacticalOffer[d].offerType){r.length=0,l=!1,r=t.tacticalOffer[d].offerPage.split("|");for(var u in r)o.toLowerCase()===r[u].trim().toLowerCase()&&(l=!0);if((""==t.tacticalOffer[d].offerCustomerType||t.tacticalOffer[d].offerCustomerType==s)&&l){c=!1,i.length=0,i=t.tacticalOffer[d].offerDeviceList.split("|");for(var p in i)a.toLowerCase()===i[p].trim().toLowerCase()&&(c=!0);"all"===t.tacticalOffer[d].offerDeviceRange?n=t.tacticalOffer[d]:"excluded"!==t.tacticalOffer[d].offerDeviceRange||c?"included"===t.tacticalOffer[d].offerDeviceRange&&c&&(n=t.tacticalOffer[d]):n=t.tacticalOffer[d]}}return n}}}),e("#spinner").show();var D="";if("byo"===s.carousel){ractiveHandsetCarousel.get("page");D="https://offer.optus.com.au/dev/api/byo-plan-new/","undefined"!=typeof secondservice&&(D="https://offer.optus.com.au/dev/api/byo-plan-secondservice"),s.development||(D="https://offer.optus.com.au/live/api/byo-plan-new/","undefined"!=typeof secondservice&&(D="https://offer.optus.com.au/live/api/byo-plan-secondservice"))}else"postpaid-mobile"===s.carousel?(D="https://offer.optus.com.au/dev/api/handset-plan-new/","undefined"!=typeof secondservice&&(D="https://offer.optus.com.au/dev/api/handset-plan-secondservice"),s.development||(D="https://offer.optus.com.au/live/api/handset-plan-new/","undefined"!=typeof secondservice&&(D="https://offer.optus.com.au/live/api/handset-plan-secondservice"))):"postpaid-tablet"===s.carousel&&(D="https://offer.optus.com.au/dev/api/tablet-plan-new",s.development||(D="https://offer.optus.com.au/live/api/tablet-plan-new"));"smb"===s.propType?D+="?type=smb":D+="?type=consumer",s.excludedPlans&&(D=D+"&exclusions="+s.excludedPlans);var L,I,A,N=[];"byo"==s.carousel&&null!=dataCache.byo?o(dataCache.byo):null!=dataCache.handset?o(dataCache.handset):e.ajax({url:D,dataType:"json",success:function(e){o(e)},error:function(){}}),ractiveHandsetCarousel.on("change",function(){setTimeout(function(){c()},50)}),ractiveHandsetCarousel.on("selectHandset",function(a,s){e(".handset").removeClass("active"),e(a.node).addClass("active"),s.storage=f(s).sort(H),s.colours=g(s.skus[0].storage,s),s.leasing||ractiveHandsetCarousel.set("paymentType","buy");var o=ractiveHandsetCarousel.get("paymentType"),n=ractiveHandsetCarousel.get("rawPlans"),r=[];"buy"==o?(r=k(s.buyPlanList,n.postpaid),N=k(s.buyPlanList,n.postpaid)):r=k(s.leasingPlanList,n.leasing),ractiveHandsetCarousel.set({selectHandset:s,selectSku:s.skus[0],plans:r}),"buy"==o?e(".leasing_copy").addClass("hide"):e(".leasing_copy").removeClass("hide");var l=u(s),i="handsets["+l+"].imageUrl";ractiveHandsetCarousel.set(i,s.skus[0].listImage),ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1),ractiveHandsetCarousel.set("bannerOffers",P(r,s));new Swiper(".banner-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,allowSwipeToPrev:!1,allowSwipeToNext:!1,nextButton:".banner-slider .swiper-container .swiper-button-next",prevButton:".banner-slider .swiper-container .swiper-button-prev",slidesPerView:1});t.init()}),ractiveHandsetCarousel.on("selectStorage",function(t,a){var s=ractiveHandsetCarousel.get("selectHandset"),o=ractiveHandsetCarousel.get("selectSku"),n=(function(e){e.splice(3,1)}(N),v(o.colour,s));if(s.colours=g(a,s),n.indexOf(a)>-1)var r=d(a,o.colour,s);else r=d(a,s.colours[0].colour,s);ractiveHandsetCarousel.set({"selectHandset.colours":s.colours,selectSku:r}),ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1)}),ractiveHandsetCarousel.on("selectColour",function(t,o,n){e("#gallery .colour, #skus .color").removeClass("active"),e(t.node).addClass("active"),e(".storage").css("display","inline-block");var r=ractiveHandsetCarousel.get("selectHandset"),l=ractiveHandsetCarousel.get("selectSku"),i=d(l.storage,o,r);r.storage=v(o,r);var c=u(r),p="handsets["+c+"].imageUrl";ractiveHandsetCarousel.set({"selectHandset.storage":r.storage,selectSku:i});var c=u(r),p="handsets["+c+"].imageUrl";if(ractiveHandsetCarousel.set(p,i.listImage),"byo"==s.carousel)var f="byo";else var f="handsetplans";for(var g=s.pageConfig.plans[f].skus,m=0;m<g.length;m++)g[m].id==i.id&&(g[m].location?(g[m].location.flex?a=g[m].location.flex:g[m].location.plus&&(a=g[m].location.plus),a=parseInt(a),L.slideTo(a)):a=!1);ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1)}),ractiveHandsetCarousel.on("customer-type",function(t,a){if(t.original.preventDefault(),ractiveHandsetCarousel.set("customerType",a),"existing"===a?(e(".filter.customer_type").removeClass("hide"),e(".filter-option.new_or_existing_new").removeClass("active"),e(".filter-option.new_or_existing_existing").addClass("active"),e(".ux-radio-button input[type=radio][value=existing]").prop("checked","checked"),"byo"==s.carousel&&(ractiveHandsetCarousel.set("contractLengthFilter",12),e(".summary").addClass("hide"))):(e(".filter.customer_type").addClass("hide"),e(".filter-option.new_or_existing_new").addClass("active"),e(".filter-option.new_or_existing_existing").removeClass("active")),ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1),"byo"==s.carousel)e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"),e(".cta .ux-button.disabled").removeClass("yellow").text("Not Available Online"),e(".summary").addClass("hide");else{var o=ractiveHandsetCarousel.get("selectSku"),n=ractiveHandsetCarousel.get("paymentType");"preorder"===o.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Pre-Order"):"backorder"===o.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Back order now"):"instock"===o.stockStatus&&("buy"==n?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"):e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Lease Now"))}var r=ractiveHandsetCarousel.get("plans"),l=ractiveHandsetCarousel.get("selectHandset");ractiveHandsetCarousel.set("bannerOffers",P(r,l));new Swiper(".banner-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,allowSwipeToPrev:!1,allowSwipeToNext:!1,nextButton:".banner-slider .swiper-container .swiper-button-next",prevButton:".banner-slider .swiper-container .swiper-button-prev",slidesPerView:1})}),ractiveHandsetCarousel.on("da-selected",function(t,a){if(ractiveHandsetCarousel.set("customerType",a),"existing"===a&&"byo"==s.carousel&&(ractiveHandsetCarousel.set("contractLengthFilter",12),e(".summary").addClass("hide")),setTimeout(function(){c()},120),ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1),"byo"==s.carousel)e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"),e(".cta .ux-button.disabled").removeClass("yellow").text("Not Available Online"),e(".summary").addClass("hide");else{var o=ractiveHandsetCarousel.get("selectSku"),n=ractiveHandsetCarousel.get("paymentType");"preorder"===o.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Pre-Order"):"backorder"===o.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Back order now"):"instock"===o.stockStatus&&("buy"==n?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"):e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Lease Now"))}var r=ractiveHandsetCarousel.get("plans"),l=ractiveHandsetCarousel.get("selectHandset");ractiveHandsetCarousel.set("bannerOffers",P(r,l));new Swiper(".banner-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,allowSwipeToPrev:!1,allowSwipeToNext:!1,nextButton:".banner-slider .swiper-container .swiper-button-next",prevButton:".banner-slider .swiper-container .swiper-button-prev",slidesPerView:1})}),ractiveHandsetCarousel.on("payment-type",function(t,a){t.original.preventDefault();var s=ractiveHandsetCarousel.get("rawPlans"),o=ractiveHandsetCarousel.get("selectHandset"),n=[];n="buy"==a?k(o.buyPlanList,s.postpaid):k(o.leasingPlanList,s.leasing),
ractiveHandsetCarousel.set("paymentType",a),ractiveHandsetCarousel.set("plans",n),"lease"===a?e(".leasing_copy").removeClass("hide"):e(".leasing_copy").addClass("hide"),ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1);var r=ractiveHandsetCarousel.get("selectSku"),l=ractiveHandsetCarousel.get("paymentType");"preorder"===r.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Pre-Order"):"backorder"===r.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Back order now"):"instock"===r.stockStatus&&("buy"==l?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"):e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Lease Now")),e(".summary").addClass("hide");var n=ractiveHandsetCarousel.get("plans"),i=ractiveHandsetCarousel.get("selectHandset");ractiveHandsetCarousel.set("bannerOffers",P(n,i));new Swiper(".banner-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,allowSwipeToPrev:!1,allowSwipeToNext:!1,nextButton:".banner-slider .swiper-container .swiper-button-next",prevButton:".banner-slider .swiper-container .swiper-button-prev",slidesPerView:1})}),ractiveHandsetCarousel.on("plan-more",function(t,a){t.original.preventDefault();var s=e(t.node).parents(".feature")[0].className;s="."+s.split(" ").join("."),e(s).find(".more-info").toggleClass("hide");var o=e(t.node).text(),n="more"===o?"less":"more";e(s).find(".more-link a").text(n),c()}),ractiveHandsetCarousel.on("selectPlan",function(t,a){var s=ractiveHandsetCarousel.get("selectSku"),o=ractiveHandsetCarousel.get("paymentType"),n=ractiveHandsetCarousel.get("page");"preorder"===s.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Pre-Order"):"backorder"===s.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Back order now"):"buy"==o?"epl"==n?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Select"):e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"):e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Lease Now"),e(".cta .ux-button.disabled").removeClass("yellow").text("Not Available Online"),e(t.node).removeClass("yellow").addClass("blue selected").text("Selected");var r=ractiveHandsetCarousel.get("rawBoltons"),i=[];if(a.boltonID.length>0){var c=a.boltonID.split("|");for(var d in c){var u=_.findWhere(r,{id:c[d]});if(void 0!=u){var p=e.extend(!0,{},u);if(p.added=!1,p.dependency.length>0){var f=_.findWhere(r,{compID:p.dependency});void 0!=f&&(p.cost=p.cost+f.cost,p.compID=p.compID+","+f.compID)}i.push(p)}}}var v={};_.each(i,function(e){var t=e.id;v[t]=e});var g=_.groupBy(i,"group"),C=[];l(v,C),ractiveHandsetCarousel.set({"selectPlan.plan":a,"selectPlan.boltons":v,"selectPlan.boltonGroup":g,"selectPlan.selectedBoltons":C});var h=ractiveHandsetCarousel.get("selectPlan.plan");"rglop"==n&&S("event","Sales Campaign Tracking","Regional Handset Tracking",h.name+" "+s.id.replace("%20"," "),0),m(),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1),w("#addons"),I=new Swiper(".fetch-swiper .swiper-container",{grabCursor:!0,nextButton:".fetch-swiper .swiper-button-next",prevButton:".fetch-swiper .swiper-button-prev",breakpoints:{6e3:{slidesPerView:4,spaceBetween:10},860:{slidesPerView:2,spaceBetween:10},500:{slidesPerView:1,spaceBetween:10}}})}),ractiveHandsetCarousel.on("learn-more",function(t,a){t.original.preventDefault();var s="Show less"===e(t.node).text()?"Show more":"Show less";e(t.node).text(s),e(t.node).prev(".more-desc").toggleClass("hide")}),ractiveHandsetCarousel.on("next-section",function(t,a){t.original.preventDefault(),w(e(t.node).closest(".sections .section").removeClass("active").find(".controls").removeClass("hide").closest(".sections .section").next().addClass("active"))}),ractiveHandsetCarousel.on("edit-section",function(t,a){t.original.preventDefault(),e(".summary").addClass("hide"),e(".sections .section").removeClass("active");e(t.node).closest(".sections .section").addClass("active").find(".controls").addClass("hide");w(".sections .section.active")}),ractiveHandsetCarousel.on("toggleContractLength",function(t,a){t.original.preventDefault(),ractiveHandsetCarousel.set({contractLengthFilter:a}),ractiveHandsetCarousel.set("selectPlan.plan",""),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1),e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"),e(".cta .ux-button.disabled").removeClass("yellow").text("Not Available Online"),e(".summary").addClass("hide")}),ractiveHandsetCarousel.on("goToSvod",function(t,a){t.original.preventDefault(),e("#svod .tab_drawer_heading").is(":visible"),e("#svod .tab_drawer_heading[rel='"+a+"']").click(),w("#svod")}),ractiveHandsetCarousel.on("addGroupBolton",function(e,t){e.original.preventDefault();var a=ractiveHandsetCarousel.get("selectPlan.selectedBoltons"),s=ractiveHandsetCarousel.get("selectPlan.boltonGroup"),o=ractiveHandsetCarousel.get("selectPlan.boltons");if(!t.added){if(""!==t.group){var n=t.group,r=s[n];_.each(r,function(e){a=i(a,e)})}t.added=!0,a.push(t),ractiveHandsetCarousel.set("selectPlan.selectedBoltons",a),ractiveHandsetCarousel.set("selectPlan.boltonGroup",s),ractiveHandsetCarousel.set("selectPlan.boltons",o),m()}}),ractiveHandsetCarousel.on("addSS",function(e,t){ractiveHandsetCarousel.set("secondServiceAdded",!0),m()}),ractiveHandsetCarousel.on("removeSS",function(e,t){ractiveHandsetCarousel.set("secondServiceAdded",!1),m()}),ractiveHandsetCarousel.on("addBolton",function(e,t){e.original.preventDefault();var a=ractiveHandsetCarousel.get("selectPlan.selectedBoltons"),s=ractiveHandsetCarousel.get("selectPlan.boltonGroup"),o=ractiveHandsetCarousel.get("selectPlan.boltons");t.added||(t.added=!0,a.push(t),ractiveHandsetCarousel.set("selectPlan.selectedBoltons",a),ractiveHandsetCarousel.set("selectPlan.boltonGroup",s),ractiveHandsetCarousel.set("selectPlan.boltons",o),m())}),ractiveHandsetCarousel.on("removeBolton",function(e,t){e.original.preventDefault();var a=ractiveHandsetCarousel.get("selectPlan.selectedBoltons"),s=ractiveHandsetCarousel.get("selectPlan.boltonGroup"),o=ractiveHandsetCarousel.get("selectPlan.boltons");a=i(a,t),ractiveHandsetCarousel.set("selectPlan.selectedBoltons",a),ractiveHandsetCarousel.set("selectPlan.boltonGroup",s),ractiveHandsetCarousel.set("selectPlan.boltons",o),m()}),ractiveHandsetCarousel.on("addSkinnyPacks",function(e,t){e.original.preventDefault();var a=ractiveHandsetCarousel.get("selectPlan.selectedBoltons"),s=ractiveHandsetCarousel.get("selectPlan.boltonGroup"),o=ractiveHandsetCarousel.get("selectPlan.boltons");if(!t.added){if(""!==t.group){var n=t.group,r=s[n];if("ULTIMATE_PACK"===t.id)_.each(r,function(e){a=i(a,e)}),t.added=!0,a.push(t);else{_.size(_.where(a,{group:n}))<3?(t.added=!0,a.push(t)):(_.each(r,function(e){a=i(a,e)}),_.each(o,function(e){"ULTIMATE_PACK"===e.id&&(e.added=!0,a.push(e))}))}}ractiveHandsetCarousel.set("selectPlan.selectedBoltons",a),ractiveHandsetCarousel.set("selectPlan.boltonGroup",s),ractiveHandsetCarousel.set("selectPlan.boltons",o),m()}}),ractiveHandsetCarousel.on("goToegal",function(t,a){if(t.original.preventDefault(),$target=e('*[data-scrollto_target="'+a+'"]'),$target.length>0){$target.is(".accordion-item-caption")&&$target.closest("li").is(":not(.active)")&&$target.trigger("click");e("html, body").animate({scrollTop:$target.offset().top-0},300)}}),ractiveHandsetCarousel.on("checkout",function(t){t.original.preventDefault(),e(t.node).closest(".add-on-section").removeClass("active").find(".controls").removeClass("hide"),e(".summary").removeClass("hide"),e(".apple-watch").addClass("hide"),w(".summary")}),ractiveHandsetCarousel.on("add-watch",function(e,t){e.original.preventDefault(),ractiveHandsetCarousel.set("isWatchAdded",!0),w(".summary"),m()}),ractiveHandsetCarousel.on("show-monthly-extras",function(t){t.original.preventDefault(),e("#monthlyFees").toggle()}),ractiveHandsetCarousel.on("show-monthly-extras-tablet",function(t){t.original.preventDefault(),e("#inclEnt").toggle()}),ractiveHandsetCarousel.on("buy-now",function(e){e.original.preventDefault();var t=(ractiveHandsetCarousel.get("page"),ractiveHandsetCarousel.get("selectSku"),ractiveHandsetCarousel.get("selectPlan"),"#"),a=ractiveHandsetCarousel.get("customerType"),o=ractiveHandsetCarousel.get("student"),n=ractiveHandsetCarousel.get("isWatchAdded");(t="p2p,p2p_c,stu,mnt,ptr,rpc,clickfrenzy,sec-srvce,fbdd,aoss,rglop,fbmetro,fbreg,augdeal,ss10dollar,hsale,39reginal,phonefest".indexOf(s.page)>-1||"p2p"==a||o||n?h():b())&&(window.location=t)});var V=null;e(window).resize(function(){null!==V&&window.clearTimeout(V),V=setTimeout(function(){c()},120)})}}(jQuery);var templateByoData="",templateHandsetData="",hTempUrl="https://offer.optus.com.au/student-hub-rebuild/api/handset-template/",bTempUrl="https://offer.optus.com.au/student-hub-rebuild/api/byo-template/";development&&(hTempUrl="https://offer.optus.com.au/dev/student-hub-rebuild/api/handset-template/",bTempUrl="https://offer.optus.com.au/dev/student-hub-rebuild/api/byo-template/"),navInit(),$.when(void 0,$.ajax({url:hTempUrl,dataType:"json",success:function(e){templateHandsetData=window.atob(e)}}),$.ajax({url:bTempUrl,dataType:"json",success:function(e){templateByoData=window.atob(e)}}),$.Deferred(function(e){$(e.resolve)})).done(function(){$(window).trigger("template-ready-to-inject")}),window.console||(console={log:function(){}}),$(window).on("template-ready-to-inject",function(){$("#contentTemplate").html(templateHandsetData),$("#contentTemplate-byo").html(templateByoData),$("#spinner-link").hide(),$(".link-section").show(),initBYOPlans()});var competitionForm={init:function(){this.setEventHandlers(),this.populateYear()},setEventHandlers:function(){var e=this;$(".competition-form button").on("click",function(){e.submit()})},populateYear:function(){for(var e="",t=1900;t<=2019;t++)e+="<option>"+t+"</option>";$('select[name="dob-year"]').append(e)},validate:function(){for(var e=0,t=$('.competition-form input[type="text"]'),a=0;a<t.length;a++)""==$(t[a]).val()&&e++;for(var s=$('.competition-form input[type="checkbox"]'),a=0;a<s.length;a++)$(s[a]).is(":checked")||e++;return e<=0},isValid:function(){return this.validate()},submit:function(){if(this.isValid()){var e="yes"==$('.competition-form input[name="existing"]').val(),t=$('.competition-form select[name="dob-year"]').val()+"-"+$('.competition-form select[name="dob-month"]').val()+"-"+$('.competition-form select[name="dob-day"]').val(),a={firstName:$('.competition-form input[name="firstname"]').val(),lastName:$('.competition-form input[name="lastname"]').val(),email:$('.competition-form input[name="email"]').val(),mobile:$('.competition-form input[name="mobile"]').val(),education:$('.competition-form input[name="education"]').val(),existingCustomer:e,dob:t,state:$('.competition-form select[name="state"]').val(),postCode:$('.competition-form input[name="postcode"]').val()};$.ajax({url:"https://offer.optus.com.au/dev/student-hub-rebuild/api/competition/",type:"POST",data:a,success:function(e){e.hasOwnProperty("success")&&!0===e.success?($(".competition-validation-error").hide(),$(".competition-submit-error").hide(),$(".competition-form").hide(),$(".competition-success").show()):$(".competition-submit-error").show()}})}else $(".competition-validation-error").show()}};$(document).ready(function(){competitionForm.init(),toggleStickyHeader(),function(e){$target=$(e),$target.length>0&&$("html, body").animate({scrollTop:$target.offset().top-0},300)}(window.location.hash),$("*[data-scrollto]").click(function(e){e.preventDefault();var t=$(this).data("scrollto");if($target=$('*[data-scrollto_target="'+t+'"]'),$target.length>0){$("html, body").animate({scrollTop:$target.offset().top-0+200},300)}}),$(window).on("scroll",function(){toggleStickyHeader()}),$(document).foundation("accordion","reflow"),$(document).foundation("reveal","reflow"),$(document).foundation("tab","reflow"),$("#competition-cta").on("click",function(){$("html, body").animate({scrollTop:$("#competition").offset().top-100},"slow")}),$(".link-plans").click(function(e){e.preventDefault();$(this).attr("href");"#sim-plans"==$(this).attr("href")&&$("#sim-plans").trigger("click"),"#phone-plans"==$(this).attr("href")&&$("#phone-plans").trigger("click")}),$("#sim-plans").click(function(e){$(".plan-type-toggle a.active").removeClass("active"),$(this).addClass("active"),e.preventDefault(),$("html, body").animate({scrollTop:$("#contentContainer").offset().top-100},"slow"),setTimeout(function(){initBYOPlans()},0)}),$("#phone-plans").click(function(e){$(".plan-type-toggle a.active").removeClass("active"),$(this).addClass("active"),e.preventDefault(),$("html, body").animate({scrollTop:$("#contentContainer").offset().top-120},"slow"),setTimeout(function(){initPhonePlans()},0)})});