(function(){aws.header={init:function(){$(document).ready(function(){function n(){var n=$(".property-success");n.hide("fast");n.addClass("displayNone")}$(".parent-menu").hoverIntent({over:headerComp.onSubMenuHoverHandler,selector:"li"});$(".alert-band").on("beforeChange",function(n,t,i,r){$(".alert-band-wrapper").css("background",$($(".alert-band .item")[r]).attr("data-bg-color"));headerComp.selectedAlertBand=headerComp.alertBandDate[r]});document.getElementsByClassName("incident-btn")[0].addEventListener("click",n)})}};aws.header.init()})();var headerComp=new window.Vue({el:".Vue-headerMenu",data:{message:"header menu",subMenuData:"",selectedMenuData:"",selectedSubmenu:"",selectedMenu:"",isActive:"",firstSubmenuList:[],firstActiveMenu:"",secondSubmenuList:[],secondActiveMenu:"",thirdSubmenuList:[],thirdActiveMenu:"",fourthSubmenuList:[],fourthActiveMenu:"",alertBandDate:[],showAlertBandView:!1,selectedAlertBand:"",invalidSubMsg:!1,phonestatus:!1,emailstatus:!1,globalSearchInput:"",maxSubmenuHeight:0,showAlertBand:!0,currentAlertBG:"",isWholesaleSite:!1,selectedPage:"",selectedSubmenuObj:{},previousMenu:{level1:undefined,level2:undefined,level3:undefined}},created:function(){this.subMenuData=JSON.parse($(".headerMegaMenuJson").text());this.selectedMenuData=_.find(this.subMenuData,function(n){return n.Selected});this.selectedSubmenuObj=_.find(this.selectedMenuData.ListofMenu,function(n){return n.selected});this.selectedPage=this.selectedSubmenuObj!==undefined?this.selectedSubmenuObj.name:"";this.alertBandDate=$(".inYourAreaAlertJsonString").text().length>0?JSON.parse($(".inYourAreaAlertJsonString").text()):{};$(".common-container").addClass(_.size(this.alertBandDate)>0?"aws-header-with-alert":"aws-header-without-alert");this.isWholesaleSite=_.toLower(this.selectedMenuData.Steam)==="wholesale"?!0:!1},mounted:function(){var t,n;if(this.alertBandDate.length>0&&(t=this,setTimeout(function(){$(".alert-band").slick({slidesToShow:1,slidesToScroll:1,vertical:!1,accessibility:!0,dots:!1,initialSlide:0,infinite:!1,arrows:!1,fade:!0});$("body").hasClass("aws-straight")&&$(".alert-band-wrapper").css("background",this.headerComp.alertBandDate[0].alertbandColour)},500),n=_.find(this.alertBandDate,function(n){return n.incident&&n.incident.showIncedentView==="Y"}),_.size(n)>0))this.onAlertBandClickHandler(n);this.$nextTick(function(){$(".Vue-headerMenu").removeClass("hidden")})},filters:{sanitizeURL:function(n){return n.split("=")[1].replace(/"/g,"")}},methods:{onMainMenuClickHandler:function(n){this.selectedMenuData.Steam=n},calculateParentHeight:function(){var n=[];$(".menu-list").each(function(t,i){var r,u;if($(i).find("li").length>0){for(r=0,u=1;u<=$(i).find("li").length;u++)r=r+$(i).find("li:nth-child("+u+")").outerHeight();n.push(r)}});this.maxSubmenuHeight=Math.max.apply(null,n)>250?Math.max.apply(null,n)+"px":"275px"},navBarHeaderHandler:function(n){n.keyCode===39?($this=n.currentTarget.parentElement.nextElementSibling,currentClassName=$(n.currentTarget.parentElement).hasClass("ct-topbar"),$this&&!currentClassName&&$($this).find(">a").focus()):n.keyCode===37&&($this=n.currentTarget.parentElement.previousElementSibling,$this&&$($this).find(">a").focus())},onKeydownClickHandler:function(n,t){n.keyCode===40?(this.secondActiveMenu="",this.secondSubmenuList=[],this.thirdActiveMenu="",this.thirdSubmenuList=[],this.fourthActiveMenu="",this.fourthSubmenuList=[],this.secondSubmenuList=t.submenu[0].submenu,this.firstActiveMenu=t.submenu[0].name,$(".first-parent-menu").find("li:first > a")[0].focus()):n.keyCode===38&&(this.secondActiveMenu="",this.secondSubmenuList=[],this.thirdActiveMenu="",this.thirdSubmenuList=[],this.fourthActiveMenu="",this.fourthSubmenuList=[],this.secondSubmenuList=t.submenu[t.submenu.length-1].submenu,this.firstActiveMenu=t.submenu[t.submenu.length-1].name,$(".first-parent-menu").find("li:last > a")[0].focus())},onKeydownClickHandler1:function(n,t,i){var f=0,r,u;if(n.keyCode===40){for(r=0;r<i.length;r++)t.name===i[r].name&&(r===i.length-1?(f=i[0],$nextelem=$(n.target).parent().parent().children().first().find("a:first")):(f=i[1+r],$nextelem=$(n.target).parent().next().find("a:first")));this.onSubMenuHoverHandler(n,f);$nextelem.focus()}else if(n.keyCode===38){for(r=0;r<i.length;r++)t.name===i[r].name&&(r===0?(f=i[i.length-1],$nextelem=$(n.target).parent().parent().children().last().find("a:first")):(f=i[r-1],$nextelem=$(n.target).parent().prev().find("a:first")));this.onSubMenuHoverHandler(n,f);$nextelem.focus()}else if(n.keyCode===39){if(t.submenu.length>0){this.onSubMenuHoverHandler(n,t.submenu[0]);t.submenu[0].megaSubMenulevel==="3"?($(".second-parent-menu").find("li:first > a")[0].focus(),this.previousMenu.level1=i):t.submenu[0].megaSubMenulevel==="4"?($(".third-parent-menu").find("li:first > a")[0].focus(),this.previousMenu.level2=i):t.submenu[0].megaSubMenulevel==="5"&&($(".fourth-parent-menu").find("li:first > a")[0].focus(),this.previousMenu.level3=i)}}else if(n.keyCode===37)if(t.megaSubMenulevel==="3"){$(".first-parent-menu").find("li:first > a")[0].focus();this.onSubMenuHoverHandler(n,this.previousMenu.level1[0]);this.previousMenu.level1=undefined}else if(t.megaSubMenulevel==="4"){$(".second-parent-menu").find("li:first > a")[0].focus();this.onSubMenuHoverHandler(n,this.previousMenu.level2[0]);this.previousMenu.level2=undefined}else if(t.megaSubMenulevel==="5"){$(".third-parent-menu").find("li:first > a")[0].focus();this.onSubMenuHoverHandler(n,this.previousMenu.level3[0]);this.previousMenu.level3=undefined}if(n.keyCode===9&&!n.shiftKey)for(u=$(".submenu-section").children().children(),r=0;r<u.length;r++)$(u[r]).hasClass("active")&&$(u[r]).find("a").focus();if(n.keyCode===9&&n.shiftKey)for(u=$(".submenu-section").children().children(),r=0;r<u.length;r++)$(u[r]).hasClass("active")&&$(u[r]).find("a").focus()},onSubMenuHoverHandler:function(n,t){t=_.isUndefined(t)?JSON.parse($(n.currentTarget).attr("data-current-menu")):t;$(".popup-overlay").show();this.selectedPage="";this.maxSubmenuHeight=0;switch(t.megaSubMenulevel){case"1":this.resetMegaMenuData();this.firstSubmenuList=t.submenu;this.selectedSubmenu=t.name;break;case"2":this.secondActiveMenu="";this.secondSubmenuList=[];this.thirdActiveMenu="";this.thirdSubmenuList=[];this.fourthActiveMenu="";this.fourthSubmenuList=[];this.secondSubmenuList=t.submenu;this.firstActiveMenu=t.name;break;case"3":this.thirdActiveMenu="";this.thirdSubmenuList=[];this.fourthActiveMenu="";this.fourthSubmenuList=[];this.thirdSubmenuList=t.submenu;this.secondActiveMenu=t.name;break;case"4":this.fourthActiveMenu="";this.fourthSubmenuList=[];this.fourthSubmenuList=t.submenu;this.thirdActiveMenu=t.name;break;case"5":this.fourthActiveMenu=t.name}this.$nextTick(function(){this.calculateParentHeight()})},resetMegaMenuData:function(){this.firstActiveMenu="";this.firstSubmenuList=[];this.secondActiveMenu="";this.secondSubmenuList=[];this.thirdActiveMenu="";this.thirdSubmenuList=[];this.fourthActiveMenu="";this.fourthSubmenuList=[]},onMenuClickHandler:function(n){window.location.href=this.$options.filters.sanitizeURL(n)},onRemoveSubMenuHandler:function(){this.selectedSubmenu="";this.resetMegaMenuData();$(".popup-overlay").hide();this.selectedPage=this.selectedSubmenuObj!==undefined?this.selectedSubmenuObj.name:""},onHoverSingleMenuHandler:function(n,t){this.selectedSubmenu="";this.selectedPage=t.name;this.resetMegaMenuData();$(".popup-overlay").hide()},onRemoveSingleMenuHandler:function(){this.selectedPage=this.selectedSubmenuObj!==undefined?this.selectedSubmenuObj.name:""},onIYAHoverHandler:function(n){this.onRemoveSubMenuHandler(n)},onAlertBandClickHandler:function(n){$(".popup-overlay").show();this.showAlertBandView=!0;this.selectedAlertBand=n;n.alertType!=="IYA"?Vue.nextTick(function(){if(!_.isUndefined($(".alertInstance"))){aws.util.onLoadImage(".alertInstance");aws.validation.customValidators()}}):(aws.validation.customValidators(),this.invalidSubMsg=!1,this.$nextTick(function(){this.drawIYAMap(this.selectedAlertBand)}))},onHideAlertpoupHandler:function(){this.showAlertBandView=!1;$(".owl-carousel").trigger("prev.owl.carousel");$(".popup-overlay").hide()},onSearchClickHandler:function(n,t){$("form[name='incident-comp']").validate({ignore:[],rules:{postcode:{required:!0,ukpostcodeSpacecheck:!0,ukpostcode:!0}},messages:{postcode:{required:"Please fill in the postcode to check eligibility",ukpostcodeSpacecheck:"Please enter a valid postcode, including a space in the middle.",ukpostcode:"Please enter a valid postcode"}},errorPlacement:function(n,t){n.appendTo(t.parent())},submitHandler:function(i){$(".css-text-postalcode").hasClass("valid")&&$.ajax({url:t.Endpointurl,contentType:"application/json",dataType:"json",data:{PostalCode:i[0].value.toUpperCase(),fileName:t.fileName},success:function(n){var i,r,t,u;if($(".responseType").removeClass("error-message success-message h4"),i=$(".property-success"),i.hide("fast"),i.addClass("displayNone"),n.Status==="Yes"&&$.trim(n.redirectUrl).length>0&&$.trim(n.Message).length===0)window.location.href=n.redirectUrl;else if(n.Status==="Yes"&&$.trim(n.Message).length>0&&$.trim(n.redirectUrl).length===0){for(r=document.createElement("textarea"),r.innerHTML=$.trim(n.Message),$(".responseType").html(r.value),$("#eligible-address-table > tbody").empty(),t=0;n.AffectedAddress.length>t;t++)u="<tr><td>"+n.AffectedAddress[t].ORGANISATION+" "+n.AffectedAddress[t].BUILDING_NAME+" "+n.AffectedAddress[t].BUILDING_NUMBER+" "+n.AffectedAddress[t].STREET+" "+n.AffectedAddress[t].LOCALITY+" "+n.AffectedAddress[t].TOWN+" "+n.AffectedAddress[t].POSTCODE+"<\/td><\/tr>",$("#eligible-address-table > tbody").append(u.replace(", ,",","));n.AffectedAddress.length==0?$(".result-heading").text():$(".result-heading").text("Total "+n.AffectedAddress.length+" affected house(s) found");i.show("fast");i.removeClass("displayNone")}else $(".responseType").addClass("success-message h4"),$(".responseType").html(n.Message)},fail:function(){$(".responseType").addClass("error-message h4");$(".responseType").html("Something went wrong! please try after sometime")},error:function(){$(".responseType").addClass("error-message h4");$(".responseType").html("Something went wrong! please try after sometime")}});n.preventDefault()}})},onSearChangeHandler:function(){$(".responseType").html("")},onSubscribeClickHandler:function(n){($(".alertemail").val().length>0||$(".alertphone").val().length>0)&&(this.emailstatus=$(".alertemail").valid(),this.phonestatus=$(".alertphone").valid());this.emailstatus!==undefined&&this.phonestatus&&$(".alertemail").valid()?this.callSubscribeform(n):this.phonestatus!==undefined&&this.emailstatus&&$(".alertphone").valid()?this.callSubscribeform(n):this.phonestatus&&this.emailstatus?this.callSubscribeform(n):$(".alertemail").val().length<=0&&$(".alertphone").val().length<=0&&(this.invalidSubMsg=!0);$("form[name='aws-subscribe-details']").validate({ignore:[],rules:{email:{required:!1,emailcode:!0},mobilenumber:{required:!1,telecode:!0}},messages:{email:{emailcode:"Please note that the correct format for e-mail id is example@example.com"},mobilenumber:{mobilecode:"Please enter 10 digit mobile number"}},errorPlacement:function(n,t){n.appendTo(t.parent())}})},callSubscribeform:function(n){$(".subscribe_btn").text("Subscribing...");var t=$("[name='__RequestVerificationToken']").val();$.post(n.subscriptionEndpointUrl,{Email:$(".alertemail").val(),TelephoneNumber:$(".alertphone").val(),Id:n.alertId,__RequestVerificationToken:t}).done(function(n,t){t==="success"&&n==="True"?$(".subscribe_btn").text("Subscribed").prepend("<span class='icon-s-correct aws-padding5-right aws-bold'><\/span>"):t==="success"&&n==="Field or repository error"&&$(".subscribe_btn").removeClass("icon-s-correct").text("Subscribe")}).fail(function(){$(".subscribe_btn").removeClass("icon-s-correct").text("Subscribe")})},drawIYAMap:function(n){this.uluru={lat:parseFloat(n.lat),lng:parseFloat(n.long)};this.mapProp={center:new google.maps.LatLng(parseFloat(n.lat),parseFloat(n.long)),zoom:10,mapTypeId:google.maps.MapTypeId.ROADMAP};this.map=new google.maps.Map(document.getElementById("googleMap"),this.mapProp);this.marker=new google.maps.Marker({position:this.uluru,map:this.map});this.rectangle=new google.maps.Rectangle({map:this.map,bounds:new google.maps.LatLngBounds(new google.maps.LatLng(parseFloat(n.extents.x1),parseFloat(n.extents.y1)),new google.maps.LatLng(parseFloat(n.extents.x2),parseFloat(n.extents.y2))),fillColor:"#F08080",strokeColor:"#800000",strokeOpacity:.8,strokeWeight:2,fillOpacity:.5});$("#alertmodal_content").on("shown.bs.modal",function(){google.maps.event.trigger(this.map,"resize")})},onClickSearchHandler:function(n){var t="";t=n.trim()!=="No results found."?'"'+n.trim()+'"':n.trim();window.location=global_aws.globalSearchPage()+"?findQuery="+t},onClickShowSearch:function(){$("#searchBox").css("display","block");$("#subMenu").css("display","none")},onClickHideSearch:function(){$("#searchBox").css("display","none");$("#subMenu").css("display","block")},onArrowClickHandler:function(n,t,i){i==="next"?this.alertBandDate.length+1!==t?$(".alert-band").slick("slickNext"):$(".alert-band").slick("slickGoTo",t):$(".alert-band").slick("slickPrev")}}})