function cloneObservable(n){return ko.mapping.fromJS(ko.toJS(n))}function DestinationsInitialiseAmMaps(n){var t={inactive:"#bbbbbb",hover:"#f05a23",selected:"#f05a23",destination:"#29abe2",buttons:"#29abe2",buttonsHover:"#1a8dbe"};AmCharts.ready(function(){function u(){i.pathToImages="/assets/plugins/ammap/images/";var r={map:"worldLow",areas:n};i.dataProvider=r;i.areasSettings={autoZoom:!1,selectable:!0,color:t.inactive,colorSolid:t.inactive,rollOverColor:t.hover,selectedColor:t.selected};i.zoomControl={buttonRollOverColor:t.buttonsHover,buttonColorHover:t.buttonsHover,buttonFillColor:t.buttons};i.fontFamily='"Montserrat", sans-serif';i.mouseWheelZoomEnabled=!0;i.write("mapdiv");i.addListener("clickMapObject",f)}function f(n){var u,f,r;e(n.mapObject.id,n.mapObject.infoUrl,n.mapObject.title);for(u in i.dataProvider.areas)r=i.dataProvider.areas[u],r.id!==n.mapObject.id&&(r.color=t.inactive,r.colorReal=r.color,i.returnInitialColor(r));for(f in n.mapObject.routes)r=i.getObjectById(n.mapObject.routes[f]),r&&r.id!==n.mapObject.id&&(r.color=t.destination,r.colorReal=r.color,i.returnInitialColor(r))}function e(n,t,i){var s=$("#map-prices"),u=s.find(".map-price"),f=$("#map-info-destination-link"),e=$("#map-info-destinations"),o;$(".map-info-countryname").text(i);TweenLite.to($("#map-info"),.3,{height:0,autoAlpha:0,ease:Power2.easeInOut});e.css("height","auto");TweenLite.to(e,.3,{autoAlpha:1,ease:Power2.easeInOut});t&&t.length?($("#map-info-href").attr("href",t),f.css("height","auto"),TweenLite.to(f,.3,{autoAlpha:1,ease:Power2.easeInOut})):TweenLite.to(f,.3,{autoAlpha:0,height:0,ease:Power2.easeInOut});u&&u.length?(o=new TimelineLite,o.staggerTo(u,.3,{x:"100%",opacity:0,ease:Power2.easeInOut},.1,0,function(){r(n)})):r(n)}function r(n){var t=$("#map-prices");t.html("");$.ajax({url:"/country/getpricesfororigin",type:"POST",data:{originCountryIso:n},success:function(i){var r,u,f,e,o;if(i&&i.length>0){for(r=0;r<i.length;r++){var s=$("<span>",{text:Localise.formatCurrency(i[r].Price)}).addClass("map-price-price"),h=i[r].Iso,u=$("<a>",{text:Localise.getCountry(i[r].Name),href:"/quote?from="+n+"&to="+h}),f=$("<div>").addClass("map-price").append(u).append(s);t.append(f)}i.length>=5&&(u=$("<a>",{text:"more...",href:"/quote?from="+n}),f=$("<div>").addClass("map-price").append(u),t.append(f));e=t.find(".map-price");o=new TimelineLite;o.staggerFromTo(e,.3,{x:"100%",opacity:0},{x:0,opacity:1,ease:Power2.easeInOut},.1)}},complete:function(){}})}var i=new AmCharts.AmMap;u()})}var localised_countries={AFGHANISTAN:"Afghanistan",ALBANIA:"Albania",ALGERIA:"Algeria",AMERICANSAMOA:"American Samoa",ANDORRA:"Andorra",ANGOLA:"Angola",ANGUILLA:"Anguilla",ANTARCTICA:"Antarctica",ANTIGUAANDBARBUDA:"Antigua and Barbuda",ARGENTINA:"Argentina",ARMENIA:"Armenia",ARUBA:"Aruba",AUSTRALIA:"Australia",AUSTRIA:"Austria",AZERBAIJAN:"Azerbaijan",BAHAMAS:"Bahamas",BAHRAIN:"Bahrain",BANGLADESH:"Bangladesh",BARBADOS:"Barbados",BELARUS:"Belarus",BELGIUM:"Belgium",BELIZE:"Belize",BENIN:"Benin",BERMUDA:"Bermuda",BHUTAN:"Bhutan",BOLIVIA:"Bolivia",BOSNIAANDHERZEGOVINA:"Bosnia and Herzegovina",BOTSWANA:"Botswana",BOUVETISLAND:"Bouvet Island",BRAZIL:"Brazil",BRITISHINDIANOCEANTERRITORY:"British Indian Ocean Territory",BRUNEIDARUSSALAM:"Brunei Darussalam",BULGARIA:"Bulgaria",BURKINAFASO:"Burkina Faso",BURUNDI:"Burundi",CAMBODIA:"Cambodia",CAMEROON:"Cameroon",CANADA:"Canada",CAPEVERDE:"Cape Verde",CAYMANISLANDS:"Cayman Islands",CENTRALAFRICANREPUBLIC:"Central African Republic",CHAD:"Chad",CHILE:"Chile",CHINA:"China",CHRISTMASISLAND:"Christmas Island",COCOSKEELINGISLANDS:"Cocos (Keeling) Islands",COLOMBIA:"Colombia",COMOROS:"Comoros",CONGO:"Congo",CONGOTHEDEMOCRATICREPUBLICOFTHE:"Congo, the Democratic Republic of the",COOKISLANDS:"Cook Islands",COSTARICA:"Costa Rica",COTEDIVOIRE:"Cote D'Ivoire",CROATIA:"Croatia",CUBA:"Cuba",CYPRUS:"Cyprus",CZECHREPUBLIC:"Czech Republic",DENMARK:"Denmark",DJIBOUTI:"Djibouti",DOMINICA:"Dominica",DOMINICANREPUBLIC:"Dominican Republic",ECUADOR:"Ecuador",EGYPT:"Egypt",ELSALVADOR:"El Salvador",EQUATORIALGUINEA:"Equatorial Guinea",ERITREA:"Eritrea",ESTONIA:"Estonia",ETHIOPIA:"Ethiopia",FALKLANDISLANDSMALVINAS:"Falkland Islands (Malvinas)",FAROEISLANDS:"Faroe Islands",FIJI:"Fiji",FINLAND:"Finland",FRANCE:"France",FRENCHGUIANA:"French Guiana",FRENCHPOLYNESIA:"French Polynesia",FRENCHSOUTHERNTERRITORIES:"French Southern Territories",GABON:"Gabon",GAMBIA:"Gambia",GEORGIA:"Georgia",GERMANY:"Germany",GHANA:"Ghana",GIBRALTAR:"Gibraltar",GREECE:"Greece",GREENLAND:"Greenland",GRENADA:"Grenada",GUADELOUPE:"Guadeloupe",GUAM:"Guam",GUATEMALA:"Guatemala",GUERNSEY:"Guernsey",GUINEA:"Guinea",GUINEABISSAU:"Guinea-Bissau",GUYANA:"Guyana",HAITI:"Haiti",HEARDISLANDANDMCDONALDISLANDS:"Heard Island and Mcdonald Islands",HOLYSEEVATICANCITYSTATE:"Holy See (Vatican City State)",HONDURAS:"Honduras",HONGKONG:"Hong Kong",HUNGARY:"Hungary",ICELAND:"Iceland",INDIA:"India",INDONESIA:"Indonesia",IRANISLAMICREPUBLICOF:"Iran, Islamic Republic of",IRAQ:"Iraq",IRELAND:"Ireland",ISRAEL:"Israel",ITALY:"Italy",JAMAICA:"Jamaica",JAPAN:"Japan",JERSEY:"Jersey",JORDAN:"Jordan",KAZAKHSTAN:"Kazakhstan",KENYA:"Kenya",KIRIBATI:"Kiribati",KOREADEMOCRATICPEOPLESREPUBLICOF:"Korea, Democratic People's Republic of",KOREAREPUBLICOF:"Korea, Republic of",KUWAIT:"Kuwait",KYRGYZSTAN:"Kyrgyzstan",LAOPEOPLESDEMOCRATICREPUBLIC:"Lao People's Democratic Republic",LATVIA:"Latvia",LEBANON:"Lebanon",LESOTHO:"Lesotho",LIBERIA:"Liberia",LIBYANARABJAMAHIRIYA:"Libyan Arab Jamahiriya",LIECHTENSTEIN:"Liechtenstein",LITHUANIA:"Lithuania",LUXEMBOURG:"Luxembourg",MACAO:"Macao",MACEDONIATHEFORMERYUGOSLAVREPUBLICOF:"Macedonia, the Former Yugoslav Republic of",MADAGASCAR:"Madagascar",MALAWI:"Malawi",MALAYSIA:"Malaysia",MALDIVES:"Maldives",MALI:"Mali",MALTA:"Malta",MARSHALLISLANDS:"Marshall Islands",MARTINIQUE:"Martinique",MAURITANIA:"Mauritania",MAURITIUS:"Mauritius",MAYOTTE:"Mayotte",MEXICO:"Mexico",MICRONESIAFEDERATEDSTATESOF:"Micronesia, Federated States of",MOLDOVAREPUBLICOF:"Moldova, Republic of",MONACO:"Monaco",MONGOLIA:"Mongolia",MONTSERRAT:"Montserrat",MOROCCO:"Morocco",MOZAMBIQUE:"Mozambique",MYANMAR:"Myanmar",NAMIBIA:"Namibia",NAURU:"Nauru",NEPAL:"Nepal",NETHERLANDS:"Netherlands",NETHERLANDSANTILLES:"Netherlands Antilles",NEWCALEDONIA:"New Caledonia",NEWZEALAND:"New Zealand",NICARAGUA:"Nicaragua",NIGER:"Niger",NIGERIA:"Nigeria",NIUE:"Niue",NORFOLKISLAND:"Norfolk Island",NORTHERNMARIANAISLANDS:"Northern Mariana Islands",NORWAY:"Norway",OMAN:"Oman",PAKISTAN:"Pakistan",PALAU:"Palau",PALESTINIANTERRITORYOCCUPIED:"Palestinian Territory, Occupied",PANAMA:"Panama",PAPUANEWGUINEA:"Papua New Guinea",PARAGUAY:"Paraguay",PERU:"Peru",PHILIPPINES:"Philippines",PITCAIRN:"Pitcairn",POLAND:"Poland",PORTUGAL:"Portugal",PUERTORICO:"Puerto Rico",QATAR:"Qatar",REUNION:"Reunion",ROMANIA:"Romania",RUSSIANFEDERATION:"Russian Federation",RWANDA:"Rwanda",SAINTHELENA:"Saint Helena",SAINTKITTSANDNEVIS:"Saint Kitts and Nevis",SAINTLUCIA:"Saint Lucia",SAINTPIERREANDMIQUELON:"Saint Pierre and Miquelon",SAINTVINCENTANDTHEGRENADINES:"Saint Vincent and the Grenadines",SAMOA:"Samoa",SANMARINO:"San Marino",SAOTOMEANDPRINCIPE:"Sao Tome and Principe",SAUDIARABIA:"Saudi Arabia",SENEGAL:"Senegal",SERBIAANDMONTENEGRO:"Serbia and Montenegro",SEYCHELLES:"Seychelles",SIERRALEONE:"Sierra Leone",SINGAPORE:"Singapore",SLOVAKIA:"Slovakia",SLOVENIA:"Slovenia",SOLOMONISLANDS:"Solomon Islands",SOMALIA:"Somalia",SOUTHAFRICA:"South Africa",SOUTHGEORGIAANDTHESOUTHSANDWICHISLANDS:"South Georgia and the South Sandwich Islands",SPAIN:"Spain",SRILANKA:"Sri Lanka",SUDAN:"Sudan",SURINAME:"Suriname",SVALBARDANDJANMAYEN:"Svalbard and Jan Mayen",SWAZILAND:"Swaziland",SWEDEN:"Sweden",SWITZERLAND:"Switzerland",SYRIANARABREPUBLIC:"Syrian Arab Republic",TAIWANPROVINCEOFCHINA:"Taiwan",TAJIKISTAN:"Tajikistan",TANZANIAUNITEDREPUBLICOF:"Tanzania, United Republic of",THAILAND:"Thailand",TIMORLESTE:"Timor-Leste",TOGO:"Togo",TOKELAU:"Tokelau",TONGA:"Tonga",TRINIDADANDTOBAGO:"Trinidad and Tobago",TUNISIA:"Tunisia",TURKEY:"Turkey",TURKMENISTAN:"Turkmenistan",TURKSANDCAICOSISLANDS:"Turks and Caicos Islands",TUVALU:"Tuvalu",UGANDA:"Uganda",UKRAINE:"Ukraine",UNITEDARABEMIRATES:"United Arab Emirates",UNITEDKINGDOM:"UK",UNITEDKINGDOMCHANNELISLANDS:"UK - Channel Islands",UNITEDKINGDOMHAI:"UK - Highlands & Islands",UNITEDKINGDOMNI:"UK - Northern Ireland",UNITEDSTATES:"United States",UNITEDSTATESMINOROUTLYINGISLANDS:"United States Minor Outlying Islands",URUGUAY:"Uruguay",UZBEKISTAN:"Uzbekistan",VANUATU:"Vanuatu",VENEZUELA:"Venezuela",VIETNAM:"Viet Nam",VIRGINISLANDSBRITISH:"Virgin Islands, British",VIRGINISLANDSUS:"Virgin Islands, U.s.",WALLISANDFUTUNA:"Wallis and Futuna",WESTERNSAHARA:"Western Sahara",YEMEN:"Yemen",ZAMBIA:"Zambia",ZIMBABWE:"Zimbabwe"},Localise={getText:function(n){return n},getCountry:function(n){return localised_countries[n]},formatCurrency:function(n){return $.isNumeric(n)?accounting.formatMoney(n,CurrencyInformation):accounting.formatMoney(0,CurrencyInformation)},formatCurrencySymbol:function(n,t){return t+parseFloat(n).toFixed(2)},initCurrencySelect:function(){$(".currency-selector").on("click",function(n){n.preventDefault?n.preventDefault():n.returnValue=!1;n.stopPropagation();var t={currencyCode:$(n.target).data("currency")};$.ajax({url:"/widget/_setcurrency",type:"POST",data:t,success:function(n){n==="ok"&&location.reload(!1);$("#currency-list-container").css("display","none")}})});$(".language-selector").on("click",function(n){n.preventDefault?n.preventDefault():n.returnValue=!1;n.stopPropagation();var t={languageCode:$(n.target).data("language-code")};$.ajax({url:"/widget/_setlanguage",type:"POST",data:t,success:function(n){n==="ok"&&location.reload(!1);$("#currency-list-container").css("display","none")}})});$("#currency-select").on("click",function(n){n.preventDefault?n.preventDefault():n.returnValue=!1;n.stopPropagation();openPopup("#dialog-localise")});$(document).on("click",function(){$("#currency-list-container").css("display","none")})}},Utilities={LOGLEVEL:{ERROR:1,WARNING:2,INFO:3},log:function(){},ajaxRequest:function(n,t,i){$.ajax({url:n,type:"get",contentType:"application/json; charset=utf-8",dataType:"json",customParams:i,success:t,statusCode:{404:function(){Utilities.log("cannot find resource",Utilities.LOGLEVEL.ERROR)},500:function(){Utilities.log("internal server error",Utilities.LOGLEVEL.ERROR)}},error:function(n,t,i){Utilities.log(t+" - "+i,Utilities.LOGLEVEL.ERROR)}})},sortDataComparator:function(n){return function(t,i){return t[n]>i[n]?1:t[n]<i[n]?-1:0}},populateSelect:function(n,t,i,r){var u,f;if(Utilities.log(n,Utilities.LOGLEVEL.INFO),this.customParams&&this.customParams.target){t=t||"Id";i=i||"Name";optionList=r?"<option value='"+r.value+"'>"+r.text+"<\/option>":"";$target=this.customParams.target;this.customParams.sort&&n.sort(Utilities.sortDataComparator(this.customParams.sort));for(u in n)f=$("<option>",{value:n[u][t]}).text(n[u][i]),optionList+=f[0].outerHTML;$target.html(optionList)}},clearValidationSummary:function(n){var i=$(n).find('[data-valmsg-summary="true"]'),t=i.find("ul");t&&t.length&&(t.empty(),i.addClass("validation-summary-valid").removeClass("validation-summary-errors"))},isMobileOrTablet:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB10|IEMobile|Opera Mini/i.test(navigator.userAgent)?!0:!1},calculateVolumetricWeight:function(n,t,i){return n*t*i/5e3},validatePostcodeFormat:function(n,t){var i,r,u;if(!t)return!0;if(!n)return!1;if(n=n.toString().toUpperCase().replace(/[-\s]+/g,"").replace(/([a-zA-Z])/g,"A").replace(/([0-9])/g,"9"),t=t.toString().toUpperCase(),i=t.split(","),i.length===0)return!0;for(r=0;r<i.length;r++)if(u=i[r].replace(/\W/g,""),n===u)return!0;return!1},getRandomInt:function(n,t){return Math.floor(Math.random()*(t-n+1))+n}},Countries={populateCountrySelect:function(n){if(Utilities.log(n,Utilities.LOGLEVEL.INFO),this.customParams&&this.customParams.target){optionList="";$target=this.customParams.target;this.customParams.sort&&(this.customParams.sort==="Name"?n.sort(Countries.sortCountryNameComparator):n.sort(Utilities.sortDataComparator(this.customParams.sort)));for(var t in n)optionList+="<option value='"+n[t].ISO+"'>"+Localise.getCountry(n[t].Name)+"<\/option>";$target.html(optionList);this.customParams.selected&&$target.parent().val(this.customParams.selected)}},sortCountryNameComparator:function(n,t){return(a=Localise.getCountry(n.Name),b=Localise.getCountry(t.Name),a>b)?1:a<b?-1:0},InitRouteCountryDropdowns:function(){this.bindRouteCountryDropdowns("body")},bindRouteCountryDropdowns:function(n){var t=$(n).find(".origin-country-select").find(".country-select"),i=t.closest(".route-country-group").find(".destination-country-select").find("select.country-select"),r=i.find("optgroup option");r.length||i.select2("enable",!1);t.on("change",function(){var n=$(this).closest(".route-country-group").find(".destination-country-select").find("select.country-select"),t=$(this).val(),i=n.val();n.html("");$.ajax({url:"/country/getdestinationcountriesview",type:"POST",data:{originCountryIso:t},success:function(t){if(t&&t.length>0){n.html(t).prepend("<option>");var r="";n.find("option").each(function(){if($(this).val()===i)return r=$(this).val(),!1});n.select2("val",r);n.find("optgroup option").length?n.select2("enable",!0):n.select2("enable",!1)}else n.select2("enable",!1)},complete:function(){}})})},FormatCountryCodeResult:function(n){return n.id?'<div class="phone-flags flags-16-AA_unknown flags-16-'+n.id+'"><\/div><strong>'+n.text+"<\/strong> "+$(n.element).data("code"):n.text},FormatCountryCodeSelection:function(n){return n.id?'<div class="phone-flags flags-16-AA_unknown flags-16-'+n.id+'"><\/div><span class="phone-flags-active-code">'+$(n.element).data("code")+"<\/span>":n.text},FormatCurrency:function(n){if(!n.id)return n.text;var t=n.text.lastIndexOf(" - "),i=n.text.slice(0,t),r=n.text.slice(t+3);return'<div class="select-currency-symbol">'+r+"<\/div>"+i}},DatePicker,_DeliveryMethodViewModel,_QuoteViewModel,_BillingAddressViewModel,_RebookMissedCollectionModel;$(function(){$.validator.addMethod("date",function(n,t){if(this.optional(t))return!0;var i=!0;try{$.datepicker.parseDate("dd/mm/yy",n)}catch(r){i=!1}return i})});DatePicker={initDatePickers:function(){this.bindDatePicker("body")},bindDatePicker:function(n){function o(n){var t="day-"+n.getDate(),i=h(n),r;return i[0]&&datePickerBlockedDays?(r=jQuery.datepicker.formatDate("yy-mm-dd",n),[$.inArray(r,datePickerBlockedDays)==-1,t,""]):[i[0],t,""]}function s(n){var t="day-"+n.getDate(),i=c(n),r;return i[0]&&datePickerBlockedDaysReturn?(r=jQuery.datepicker.formatDate("yy-mm-dd",n),[$.inArray(r,datePickerBlockedDaysReturn)==-1,t,""]):[i[0],t,""]}function u(n){var t="day-"+n.getDate();return[!0,t,""]}function h(n){var t;return datePickerCustomWeekend&&datePickerCustomWeekend.length>0?(t=n.getDay(),$.inArray(t,datePickerCustomWeekend)!=-1?[!1,""]:[!0,""]):$.datepicker.noWeekends(n)}function c(n){var t;return datePickerCustomWeekendReturn&&datePickerCustomWeekendReturn.length>0?(t=n.getDay(),$.inArray(t,datePickerCustomWeekendReturn)!=-1?[!1,""]:[!0,""]):$.datepicker.noWeekends(n)}var e=new Date,f=e.getUTCDay(),i=1,t=1,r=2;Utilities.isMobileOrTablet()&&(r=1);f==6?i=2:f==5&&(i=3);$(n).find(".datepicker").each(function(){var l=$(this).data("function"),h=o,n,f,u,c,e;switch(l){case"noWeekendsOrHolidaysReturn":h=s}n=$(this).data("altfield")||"";f=null;n.length>0&&(f=function(){$(n).change()});u=$(this).data("mindate")||"";u.length>0&&u!=1&&(t=new Date(u),c=t.getTimezoneOffset(),t.setMinutes(t.getMinutes()-c));e=$(this).data("selecteddate")||"";e.length>0&&(i=e);$(this).datepicker({dateFormat:"dd/mm/yy",beforeShowDay:h,onClose:function(){$(this).attr("disabled",!1)},beforeShow:function(){$(this).attr("disabled",!0)},minDate:t,maxDate:"+1y",numberOfMonths:r,defaultDate:i,altField:n,onSelect:f})});$(n).find(".datepicker-noweekends").datepicker({dateFormat:"dd/mm/yy",onClose:function(){$(this).attr("disabled",!1)},beforeShow:function(){$(this).attr("disabled",!0)},beforeShowDay:$.datepicker.noWeekends,minDate:1,maxDate:"+1y",numberOfMonths:r,defaultDate:i});$(n).find(".datepicker-weekends").datepicker({dateFormat:"dd/mm/yy",onClose:function(){$(this).attr("disabled",!1)},beforeShow:function(){$(this).attr("disabled",!0)},beforeShowDay:u,minDate:1,maxDate:"+1y",numberOfMonths:r,defaultDate:i});$(n).find(".datepicker-weekends-today").datepicker({dateFormat:"dd/mm/yy",onClose:function(){$(this).attr("disabled",!1)},beforeShow:function(){$(this).attr("disabled",!0)},beforeShowDay:u,minDate:0,maxDate:"+1y",numberOfMonths:r,defaultDate:i});$(n).find(".datepicker-any").datepicker({dateFormat:"dd/mm/yy",onClose:function(){$(this).attr("disabled",!1)},beforeShow:function(){$(this).attr("disabled",!0)},beforeShowDay:u,numberOfMonths:r,defaultDate:i,changeMonth:!0,changeYear:!0,yearRange:"-100:+2"});$(n).find(".datepicker-custom").each(function(){var n=$(this).data("mindate")||"",t=$(this).data("maxdate")||"";$(this).datepicker({dateFormat:"dd/mm/yy",onClose:function(){$(this).attr("disabled",!1)},beforeShow:function(){$(this).attr("disabled",!0)},beforeShowDay:u,numberOfMonths:r,defaultDate:i,changeMonth:!0,changeYear:!0,yearRange:"-100:+2",minDate:n,maxDate:t})});$(n).find(".datepicker-all").each(function(){var n=$(this).data("mindate")||"",i;n.length>0&&n!=1&&(t=new Date(n),i=t.getTimezoneOffset(),t.setMinutes(t.getMinutes()-i));$(this).datepicker({dateFormat:"dd/mm/yy",onClose:function(){$(this).attr("disabled",!1)},beforeShow:function(){$(this).attr("disabled",!0)},minDate:t,maxDate:"+1y",numberOfMonths:r,defaultDate:t})})}};$(document).ready(function(){var u,i,r,n,t;$("#btn-show-main-menu").on("click",showMainNav);$("#btn-close-main-menu").on("click",hideMainNav);$("body").on("mouseenter",".tooltip",openTooltip);Localise.initCurrencySelect();setTimeout(beginAnimations,200);$(".accordion-tab").on("click",accordionClick);if(accordionInitialise(),forms.initialise(),u=function(){var t=$("#splash-inner-container"),n;t.length&&(n=$("<div>").attr("class","splash-image splash-image-02"),t.append(n),n=$("<div>").attr("class","splash-image splash-image-03"),t.append(n),n=$("<div>").attr("class","splash-image splash-image-04"),t.append(n),n=$("<div>").attr("class","splash-image splash-image-05"),t.append(n),i())},i=function(){var t=$(".splash-image-active"),n=t.next();n=n.length?n:t.siblings().first();n.addClass("splash-image-next");TweenLite.fromTo(n,.75,{opacity:0,scale:1.1},{delay:8,opacity:1,scale:1,onComplete:function(){n.addClass("splash-image-active").removeClass("splash-image-next");t.removeClass("splash-image-active");TweenLite.set(t,{opacity:0});i()}})},u(),r=$("#order-summary-position"),n=$("#order-summary-container"),r.length&&n.length){function f(){var t=r.offset(),i=t.top-$(window).scrollTop(),u=$(window).height(),f=n.outerHeight();i<=20&&u-f>20?n.addClass("order-summary-fixed"):n.removeClass("order-summary-fixed")}$(window).scroll(f);f()}if(t=$(".fixed-panel"),t.length){function e(){t.each(function(){var n=$(this).data("top"),t=$(this).data("offset"),i=$(window).scrollTop(),r=$(window).height(),u=$(this).find(".fixed-panel-content").outerHeight();i>t&&r-u>n?$(this).addClass("fixed-active").css("top",n+"px"):$(this).removeClass("fixed-active").css("top","")})}t.each(function(){$(this).data("offset",$(this).offset().top)});$(window).scroll(e);e()}$(".fix-external-links").find("a[href^='http:'],a[href^='https:']").not("[href*='.sendmybag.']").attr("target","_blank").attr("rel","nofollow");$(".recaptcha-submit-button").on("click",onRecaptchaClick)});var showMainNav=function(n){n.preventDefault?n.preventDefault():n.returnValue=!1;TweenLite.to($("#main-nav"),1,{top:"0%",ease:Power2.easeOut})},hideMainNav=function(n){n.preventDefault?n.preventDefault():n.returnValue=!1;TweenLite.to($("#main-nav"),1,{top:"-"+$("#main-nav").outerHeight(),ease:Power2.easeIn})},openTooltip=function(n){n.preventDefault?n.preventDefault():n.returnValue=!1;$(this).find(".tooltip-text").show();$(this).on("mouseleave",closeTooltip);$(this).on("click",closeTooltip)},closeTooltip=function(n){n.preventDefault?n.preventDefault():n.returnValue=!1;$(this).find(".tooltip-text").hide();$(this).off("mouseleave",closeTooltip);$(this).off("click",closeTooltip)},accordionClick=function(n){n.preventDefault?n.preventDefault():n.returnValue=!1;var t=$(this).closest(".accordion"),i=t.find(".accordion-panel"),r=t.find(".faq-question");t.hasClass("accordion-closed")?r.length?TweenLite.to(i,.3,{height:i.find(".faq-answer").outerHeight(),onComplete:function(){t.removeClass("accordion-closed")}}):TweenLite.to(i,.3,{height:i.find(".living-guide-sub-nav").outerHeight(),onComplete:function(){t.removeClass("accordion-closed")}}):TweenLite.to(i,.3,{height:0,onComplete:function(){t.addClass("accordion-closed")}})},accordionInitialise=function(){$(".accordion-panel").each(function(){$(this).height(0);$(this).closest(".accordion").addClass("accordion-closed")})},beginAnimations=function(){$("body").removeClass("anim-before-load")},recaptchaFormToSubmit,onRecaptchaClick=function(n){return(n.preventDefault?n.preventDefault():n.returnValue=!1,recaptchaFormToSubmit=$(this).closest("form"),!recaptchaFormToSubmit.valid())?!1:(grecaptcha.execute(),!1)},onRecaptchaSubmit=function(){recaptchaFormToSubmit.submit()};$(document).ready(function(){customcontrols.initialise($(document));DatePicker.initDatePickers();Countries.InitRouteCountryDropdowns();$(".open-popup").magnificPopup({type:"inline",midClick:!0,removalDelay:300,mainClass:"mfp-zoom-in"});$(".open-modal-popup").magnificPopup({type:"inline",midClick:!0,removalDelay:300,mainClass:"mfp-zoom-in",modal:!0,callbacks:{open:function(){setTimeout(function(){$(name+" input:text, "+name+" input:password, "+name+" textarea").filter(":visible").eq(0).focus()},200)}}});$("body").on("click",".close-popup",function(){$.magnificPopup.close();setTimeout(function(){$("html").removeClass("minimised-popup")},200)});$("#payment-card-type-container").length&&payments.initialise();$("body").removeClass("preload");$("body").addClass("preload-complete");$(".side-overlay-close").on("click",function(n){n.preventDefault?n.preventDefault():n.returnValue=!1;$.ajax({url:"/account/_closenextStepsdialog"});$(this).closest(".side-overlay-window").addClass("side-overlay-window-hidden")});$(".trigger-dependancy").on("change, keyup",function(){var n=$('.visibility-depends-on[data-dependancy="'+$(this).prop("id")+'"]');$(this).val()?n.css("display","block"):n.css("display","none")})});$.validator.unobtrusive.adapters.addBool("mandatory","required");$(function(){$htmlbody=$("html,body");$('a[href*=#]:not([href=#]):not(".open-popup"):not(".open-modal-popup")').click(function(){if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){var n=$(this.hash);if(n=n.length?n:$("[name="+this.hash.slice(1)+"]"),n.length)return $htmlbody.animate({scrollTop:n.offset().top},1e3),!1}})});var showRouteAlerts=function(n,t){$.ajax({url:"/quote/getestimateddateforupdate",type:"POST",data:{CollectionDate:n,JourneyId:t},success:function(n){var t,i;n.PublicHolidays!=null&&n.PublicHolidays.length>0?(t='<i class="icon-warning-sign"><\/i>   Please be aware that the following dates are public holidays and could potentially affect your transit times:<ul>',n.PublicHolidays.forEach(function(n){t+="<li>"+moment(n.Key).format("Do MMMM YYYY")+" - "+n.Value+"<\/li>"}),t+="<\/ul>",$(".public-holidays").html(t)):$(".public-holidays").empty();n.Information&&n.Information.length&&($("#update-collection-date-content").hide(),i=n.Information+'<div class="btn-standard close-popup-collection-date-update">I Agree<\/div>',$(".route-alert").html(i),$(".route-alert").show());$(".close-popup-collection-date-update").on("click",function(){$("#update-collection-date-content").show();$(".route-alert").hide()})}})},showModalWindow=function(n){$("#modal-header").html(dialog_content_array[n].Title);$("#modal-content").html(dialog_content_array[n].Description);openModalPopup("#dialog-info")},openPopup=function(n){$.magnificPopup.open({items:{src:n},type:"inline",removalDelay:300,mainClass:"mfp-zoom-in"})},openImagePopup=function(n){$.magnificPopup.open({items:{src:n},type:"image",closeOnContentClick:!0})},openModalPopup=function(n){$.magnificPopup.open({items:{src:n},type:"inline",removalDelay:300,mainClass:"mfp-zoom-in",modal:!0,callbacks:{open:function(){setTimeout(function(){$(n+" input:text, "+n+" input:password, "+n+" textarea").filter(":visible").not(".datepicker").eq(0).focus()},200)}}})},closeModalPopup=function(){$.magnificPopup.close()},safeBool=function(n){return n!=null&&n.toString().toLowerCase()==="true"?!0:!1},_SecurityNoticeVM=function(n){var t=this;t.SecurityMessageYes=ko.observable(!1);t.SecurityMessageNo=ko.observable(!1);ko.mapping.fromJSON(n,{},t);t.BagPackedByCustomer.subscribe(function(){t.BagPackedByCustomer()=="True"?(t.SecurityMessageNo(!1),t.SecurityMessageYes(!0)):(t.SecurityMessageYes(!1),t.SecurityMessageNo(!0));$("#security-notice-validation").hide()})},Initialisers={initContactPage:function(){$("#form-contact-us").on("submit",function(){$(this).valid()&&($("#btn-contact-us").attr("disabled","disabled"),$(this).addClass("is-loading"))});$("#contact-reason").on("change",function(){var n=$(this).val().toLowerCase();n.indexOf("order")>-1?$("#order-number-container").show(200):$("#order-number-container").hide(200)})},initDestinationDetails:function(){$("#Origin_CountryIso").on("change",Initialisers.destinationDetailsCountryChange);Initialisers.destinationDetailsCountryChange()},destinationDetailsCountryChange:function(){var o=$("#destination-countryIso").val(),s=$("#Origin_CountryIso").val(),t=$(".destination-customs"),i=$(".destination-customs-anchor"),r=$("#restricted-items-express"),u=$("#restricted-items-standard"),f=$("#required-clearance-documents"),n=50,e={originCountryIso:s,destinationCountryIso:o};$.ajax({url:"/country/_customs",type:"POST",data:e,success:function(f){f.hasCustoms==="true"?(t.show(n),i.show(n)):(t.hide(n),i.hide(n));f.hasStandardRoute==="true"?(r.hide(n),u.show(n)):(r.show(n),u.hide(n))},error:function(){t.show(n);i.show(n);r.show(n);u.hide(n)},complete:function(){}});$.ajax({url:"/widget/_requiredclearancedocuments",type:"POST",data:e,success:function(n){f.html(n)},error:function(){f.html("Problem getting Required Clearance documents.")},complete:function(){}})}};(function(n){n.initialise=function(n){Utilities.isMobileOrTablet()||(n.find(".select2").select2({width:"resolve",matcher:function(n,i,r){return t(n,i,r)}}),n.find(".select2-full").select2({width:"off",matcher:function(n,i,r){return t(n,i,r)}}),n.find(".select2-currency").select2({width:"resolve",formatResult:Countries.FormatCurrency,formatSelection:Countries.FormatCurrency,matcher:function(n,i,r){return t(n,i,r)}}),n.find(".select2-allowclear").select2({width:"resolve",matcher:function(n,i,r){return t(n,i,r)},allowClear:!0}));n.find(".phonenumber-countrycode").select2({width:"off",dropdownAutoWidth:!0,dropdownCssClass:"countrycode-dropdown",formatResult:Countries.FormatCountryCodeResult,formatSelection:Countries.FormatCountryCodeSelection,escapeMarkup:function(n){return n},matcher:function(n,i,r){return t(n,i,r)}})};var t=function(n,t,i){var r=i.data("alt")||"";return t.toUpperCase().indexOf(n.toUpperCase())>=0||r.toUpperCase().indexOf(n.toUpperCase())>=0}})(window.customcontrols=window.customcontrols||{},jQuery),function(n,t){function e(){t(this).valid()&&u(t(this))}function o(i){t(this).hasClass("no-prevent-default")||(i.preventDefault?i.preventDefault():i.returnValue=!1,i.stopPropagation());t(this).hasClass("prevent-ajax-form")?n.loadFormDialog("#popup-dynamic-container",t(this).data("href"),{id:t(this).data("id")},null,"#popup-dynamic-container"):n.loadFormDialog("#popup-dynamic-container",t(this).data("href"),{id:t(this).data("id")},n.makeAjaxForm,"#popup-dynamic-container")}function s(n,t){return u(t),!0}function h(r,u,e,o){var a=!1,c,h,s,l,v;if(r)if(r.RedirectUrl&&r.RedirectUrl.length)window.location.replace(r.RedirectUrl),a=!0;else if(r.Reload&&r.Reload.length)window.location.hash="#"+r.Reload,window.location.reload(),a=!0;else if(r.LoadDialog&&r.LoadDialog.length)n.loadFormDialog("#popup-dynamic-container",r.LoadDialog,{id:0},n.makeAjaxForm,"#popup-dynamic-container");else if(r.Close){if(r.AdditionalData&&r.AdditionalData.length){if(c=JSON.parse(r.AdditionalData),r.UpdateText)for(h in c)t("."+h).text(c[h]).trigger("change");for(h in c)t("#"+h).val(c[h]).trigger("change")}closeModalPopup()}else r.errors&&r.errors.length?(s=i(o),s.html(""),l=t("<ul/>").addClass("fa-ul").appendTo(s),t.each(r.errors,function(){var n=t("<li/>").html(this).appendTo(l);t("<i/>").addClass("fa-li fa fa-exclamation-circle").prependTo(n)})):(s=i(o),s.html(""),l=t("<ul/>").addClass("fa-ul").appendTo(s),v=t("<li/>").html("An unexpected error has occured").appendTo(l),t("<i/>").addClass("fa-li fa fa-exclamation-circle").prependTo(v));a===!1&&f(o)}function c(n,t,r,u){var e=i(u);e.text("An unknown error occurred, please try again or contact us.");f(u)}function u(n){n.addClass("submitting")}function f(n){n.removeClass("submitting")}function i(n){var i=n.find(".error-container");return i.length===0&&(i=t('<div class="error-container"><\/div>').appendTo(n)),i}function l(n){var i=n.find(".form-loading-overlay"),r=n.find(".form-loading-animation");i.length===0&&(i=t("<div/>").addClass("form-loading-overlay").prependTo(n));r.length===0&&(r=t("<i/>").addClass("fa fa-refresh fa-spin form-loading-animation").prependTo(n))}function a(){var r=t(this).attr("id"),i=t('.selecteditem-information[data-for="'+r+'"]'),n=t(this).find(":selected").data("information");n&&n.length?i.html(n):i.html("")}var r={target:"",beforeSubmit:s,success:h,error:c};n.initialise=function(){var i=t(".jqueryAjaxForm"),n,u;i.ajaxForm(r);n=t("form");u=n.not(i);u.on("submit",e);n.filter('[data-disabled="true"]').each(function(){t(this).find(":input").prop("disabled",!0)});t(".load-action-dialog").on("click",o);t("body").on("change","select.has-additional-information",a)};n.makeAjaxForm=function(n){var i=t(n).find("form");i.ajaxForm(r);l(i)};n.loadAction=function(n,i,r){n.addClass("is-loading");t.ajax({url:i,type:"get",data:r,success:function(t){n.html(t)},error:function(){n.html("Sorry it looks like there was an error loading this data, please try again or contact us.")},complete:function(){n.removeClass("is-loading")}})};n.loadFormDialog=function(n,i,r,u,f){var e=t(n);t.ajax({url:i,type:"get",data:r,success:function(i){e.html(i);openModalPopup(n);var r=e.find("form").removeData("validator").removeData("unobtrusiveValidation");t.validator.unobtrusive.parse(r);DatePicker.bindDatePicker(n);t(".update-collection-date .datepicker").datepicker("option","onSelect",function(n,i){var r=i.selectedYear+"-"+(i.selectedMonth+1)+"-"+i.selectedDay,u=t("#JourneyId").val();showRouteAlerts(r,u)});Countries.bindRouteCountryDropdowns(n);Utilities.isMobileOrTablet()||e.find(".select2").select2({width:"resolve"});t(".phonenumber-countrycode").select2({width:"off",dropdownAutoWidth:!0,dropdownCssClass:"countrycode-dropdown",formatResult:Countries.FormatCountryCodeResult,formatSelection:Countries.FormatCountryCodeSelection,escapeMarkup:function(n){return n}});u&&u(f)},error:function(n,t,i){alert("Sorry there was an error loading the dialog");Utilities.log(t+" - "+i,Utilities.LOGLEVEL.ERROR)},complete:function(){}})}}(window.forms=window.forms||{},jQuery);_DeliveryMethodViewModel=function(n){var t=this;ko.mapping.fromJS(n,{},t);t.TransitTimeFormatted=ko.computed(function(){return t.MinTransitTime()==t.MaxTransitTime()?t.MinTransitTime():t.MinTransitTime()+"-"+t.MaxTransitTime()})};_QuoteViewModel=function(n){var t=this,u=!1,f=!1,r,i;if(ko.mapping.fromJSON(n,{},t),delete t.BagsSelectList,delete t.CountryLists,t.TotalCost=ko.observable(0),t.DeliveryDate=ko.observable(),t.DeliveryDateReturn=ko.observable(),t.MaxWeight=ko.observable(0),t._HasRasCharge=ko.observable(!1),t._DeliveryMethods=ko.observableArray(),t.DiscountAmount=ko.observable(0),t.DiscountDescription=ko.observable(""),t.EmailQuoteAddress=ko.observable(""),t.GettingQuote=ko.observable(!1),t.GettingQuoteDeliveryMethods=ko.observable(!1),t.GettingDeliveryDate=ko.observable(!1),t.GettingDeliveryDateReturn=ko.observable(!1),t.GettingRouteAlerts=ko.observable(!1),t._TriggerQuoteUpdate=ko.observable(!1),t._QuoteNeedsRefreshing=ko.observable(!1),t.IsRouteAvailable=ko.observable(!0),t.Origin._LoadingRegions=ko.observable(!1),t.Destination._LoadingRegions=ko.observable(!1),t.Origin.RegionSelectEnabled=ko.observable(!0),t.Destination.RegionSelectEnabled=ko.observable(!0),t.Origin.ProvinceName=ko.observable(""),t.Destination.ProvinceName=ko.observable(""),t.Origin._PostcodeValidOrEmpty=ko.observable(!0),t.Destination._PostcodeValidOrEmpty=ko.observable(!0),t.ForceBookNow=ko.observable(!1),t.FormToSubmit=ko.observable(),t.AdrollSegmentId=ko.observable("8440954f"),t.BlockReturnRoute=ko.observable(),t.DisplayPriceMatch=ko.observable(!1),t.Student=ko.observable(),t.StudentText=ko.observable(!1),t.UpdateStudentFlag=function(){return t.Student()=="True"?(t.StudentText(!0),t.CustomerPriceGroupId(t.StudentPriceGroupId())):(t.StudentText(!1),t.CustomerPriceGroupId(null)),t.DisplayPriceMatch(!0),!0},t.ShowRegions=ko.computed(function(){return t.Origin.CountryIso()&&t.Origin.CountryIso()==="US"&&t.Destination.CountryIso()&&t.Destination.CountryIso()==="US"?!0:!1}),t.IsFormReady=ko.computed(function(){return t.Origin.CountryUsesPostcode()&&t.Origin._PostcodeValidOrEmpty()!==!0?!1:t.Destination.CountryUsesPostcode()&&t.Destination._PostcodeValidOrEmpty()!==!0?!1:t.Origin.CountryIso()&&t.Destination.CountryIso()?t.ShowRegions()?t.Origin.RegionId()&&t.Destination.RegionId()?!0:!1:!0:!1}),t.PriceMatchUrl=ko.computed(function(){if(t.IsFormReady()===!0){var n=t.Origin.CountryIso(),i=t.Destination.CountryIso(),r=t.JourneyType();return"/quote/pricematch?origin="+n+"&destination="+i+"&journeyType="+r}return""}),t.ShowPostcodes=ko.computed(function(){return!t.ShowRegions()&&t.Origin.CountryIso()&&t.Destination.CountryIso()?!0:!1}),t.IsUKDomesticRoute=ko.computed(function(){return t.IsFormReady()&&t.Origin.CountryIso().slice(0,2)=="GB"&&t.Destination.CountryIso().slice(0,2)=="GB"?!0:!1}),t.CollectionDateFormatted=ko.computed({read:function(){return t.CollectionDate()?moment(t.CollectionDate()).format("DD/MM/YYYY"):null},write:function(n){t.CollectionDate(moment(n,"DD/MM/YYYY").toDate())}}),t.CollectionDateReturnFormatted=ko.computed({read:function(){return t.CollectionDateReturn()?moment(t.CollectionDateReturn()).format("DD/MM/YYYY"):null},write:function(n){t.CollectionDateReturn(moment(n,"DD/MM/YYYY").toDate())}}),t.IsReturn=ko.computed(function(){return t.JourneyType()==="Return"}),t.CountryChange=function(n,i){var r=$("#"+i+"_CountryIso").find(":selected"),u=$("#"+i+"_RegionId");n.Postcode(null);n.RegionId(null);u.select2("val",null);u.html("");t.DeliveryMethodType(1);n.CountryUsesPostcode(r.data("usespostcode")==="False"?!1:!0);n.CountryPostcodeFormat(r.data("postcodeformat"));n.CountryUsesRegions(r.data("usesregions")==="False"?!1:!0);i==="Destination"&&t.AdrollSegmentId(r.data("adrollsegmentid"));t.updateRegions(n,i)},t.Origin.CountryIso.subscribe(function(){t.CountryChange(t.Origin,"Origin")}),t.Destination.CountryIso.subscribe(function(){t.CountryChange(t.Destination,"Destination")}),t.Origin.ProvinceName.subscribe(function(){t.ProvinceNameChange(t.Origin,"Origin")}),t.Destination.ProvinceName.subscribe(function(){t.ProvinceNameChange(t.Destination,"Destination")}),t.Origin.RegionId.subscribe(function(){}),t.Destination.RegionId.subscribe(function(){}),t.PriceMatchModel&&(t.PriceMatchModel.Origin.RegionId.subscribe(function(){t.Origin.RegionId(t.PriceMatchModel.Origin.RegionId())}),t.PriceMatchModel.Destination.RegionId.subscribe(function(){t.Destination.RegionId(t.PriceMatchModel.Destination.RegionId())})),t.ProvinceNameChange=function(n,t){if(n.CountryUsesRegions()&&n.ProvinceName()&&n.ProvinceName().length>0){var i=$("#"+t+"_RegionId"),u=n.ProvinceName().toLowerCase(),r="";i.find("option").each(function(){if($(this).text().toLowerCase()===u)return r=$(this).val(),!1});i.select2("val",r)}},t.updateRegions=function(n,t){if(n.CountryUsesRegions()){n._LoadingRegions(!0);var i={countryIso:n.CountryIso()};Utilities.log("getting regions...",Utilities.LOGLEVEL.INFO);Utilities.log(i,Utilities.LOGLEVEL.INFO);$.ajax({url:"/country/getcountryregions",type:"POST",data:i,success:function(n){Utilities.log("...getting regions success",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);Utilities.log("-",Utilities.LOGLEVEL.INFO);var i={target:$("#"+t+"_RegionId_select")};Utilities.populateSelect.call({customParams:i},n,"Value","Text",{value:"",text:""})},error:function(){Utilities.log("...getting regions failed",Utilities.LOGLEVEL.INFO)},complete:function(){n._LoadingRegions(!1)}})}},t.PostcodeChange=function(n,t){if(n.CountryUsesPostcode()&&n.Postcode()&&n.Postcode().length>0&&!Utilities.validatePostcodeFormat(n.Postcode(),n.CountryPostcodeFormat())){$("#"+t+"_Postcode").addClass("custom-input-validation-error");$('.custom-validation-message[data-for="'+t+'_Postcode"]').show();n._PostcodeValidOrEmpty(!1);return}$("#"+t+"_Postcode").removeClass("custom-input-validation-error");$('.custom-validation-message[data-for="'+t+'_Postcode"]').hide();n._PostcodeValidOrEmpty(!0)},t._TriggerQuoteUpdate.subscribe(function(n){n===!0&&t._TriggerQuoteUpdate(!1)}),ko.computed(function(){t.Origin.CountryIso();t.Destination.CountryIso();t.JourneyType();t.DeliveryMethodType();t.TotalBags();t.Origin.RegionId();t.Destination.RegionId();t._QuoteNeedsRefreshing(!1);t._TriggerQuoteUpdate(!0)},this).extend({rateLimit:100,method:"notifyWhenChangesStop"}),ko.computed(function(){t.Origin.Postcode();t.Destination.Postcode();t.PostcodeChange(t.Origin,"Origin");t.PostcodeChange(t.Destination,"Destination");(t.Origin.Postcode()&&t.Origin.Postcode().length>0||t.Destination.Postcode()&&t.Destination.Postcode().length>0)&&t._QuoteNeedsRefreshing(!0)},this).extend({rateLimit:100,method:"notifyWhenChangesStop"}),t.PostcodeBlur=function(){t.PostcodeChange(t.Origin,"Origin");t.PostcodeChange(t.Destination,"Destination");t._QuoteNeedsRefreshing(!1);t._TriggerQuoteUpdate(!0)},ko.computed(function(){var i,n,r;(t.PostcodeChange(t.Origin,"Origin"),t.PostcodeChange(t.Destination,"Destination"),t.IsFormReady())&&(t.GettingQuoteDeliveryMethods(!0),t.GettingRouteAlerts(!0),i={ignore:["CollectionDate","CollectionDateReturn"]},t.DeliveryMethodRequestId("Req"+Utilities.getRandomInt(1e4,999999)),n=ko.mapping.toJSON(t,i),Utilities.log("getting delivery methods...",Utilities.LOGLEVEL.INFO),Utilities.log(n,Utilities.LOGLEVEL.INFO),$.ajax({url:"/quote/getquotedeliverymethodsjson",type:"POST",contentType:"application/json",data:n,success:function(n){var e,r,o,i,f,s,h;if(Utilities.log("...complete (getting delivery methods)",Utilities.LOGLEVEL.INFO),Utilities.log(n,Utilities.LOGLEVEL.INFO),Utilities.log("-",Utilities.LOGLEVEL.INFO),n&&n.DeliveryMethodRequestId===t.DeliveryMethodRequestId()){if(t._DeliveryMethods.removeAll(),n.Methods.length>0){for(t.MaxWeight(n.Methods[0].CourierMaxWeight),t._HasRasCharge(n.HasRasCharge),e=!1,r=0;r<n.Methods.length;r++)t._DeliveryMethods.push(new _DeliveryMethodViewModel(n.Methods[r])),n.Methods[r].DeliveryMethodType===t.DeliveryMethodType()&&(e=!0);if(e||t.DeliveryMethodType(n.Methods[0].DeliveryMethodType),u===!1){u=!0;try{fbq("track","Get Quote")}catch(c){}try{for(o=[],i=0;i<n.Methods.length;i++)for(f=0;f<n.Methods[i].Tiers.length;f++)s=n.Methods[i].DeliveryMethodType===1?"Standard":"Express",h=t.Origin.CountryIso()+(n.Methods[i].OriginAddressGroupId!=null?"_"+n.Methods[i].OriginAddressGroupId:"")+"-"+t.Destination.CountryIso()+(n.Methods[i].DestinationAddressGroupId!=null?"_"+n.Methods[i].DestinationAddressGroupId:"")+"-"+s+"-"+n.Methods[i].Tiers[f].MaxWeightKg+"-"+n.CurrencyCode,o.push(h);fbq("track","ViewContent",{content_type:"product",content_ids:o})}catch(c){}try{__adroll.record_user({adroll_segments:t.AdrollSegmentId()})}catch(c){}try{twq("track","GetQuote")}catch(c){}}}else t.MaxWeight(0);t.GettingQuoteDeliveryMethods(!1)}},error:function(){t.MaxWeight(0);t.GettingQuoteDeliveryMethods(!1)},complete:function(){}}),$.ajax({url:"/quote/hasroutegotreturn",type:"POST",contentType:"application/json",data:n,success:function(n){if(n=="False"){t.JourneyType("OneWay");t.BlockReturnRoute(!0);return}t.BlockReturnRoute(!1)}}),r={originCountryIso:t.Origin.CountryIso(),destinationCountryIso:t.Destination.CountryIso(),isReturn:t.IsReturn(),originPostcode:t.Origin.Postcode(),destinationPostcode:t.Destination.Postcode()},$.ajax({url:"/country/_routealerts",type:"POST",data:r,success:function(n){$("#route-alerts").html(n).css("display","block")},error:function(){},complete:function(){t.GettingRouteAlerts(!1)}}))},this).extend({rateLimit:10}),t.changeJourneyType=function(){t.JourneyType()==="Return"?t.JourneyType("OneWay"):t.JourneyType("Return")},t.CountryChange(t.Origin,"Origin"),t.CountryChange(t.Destination,"Destination"),$("#dialog-email-quote").length!=0){$("#quoteSubmit").on("click",function(n){if(n.preventDefault?n.preventDefault():n.returnValue=!1,n.stopPropagation(),!$("#quoteForm").valid())return!1;var r=t.EmailQuoteAddress(),i=ko.mapping.toJSON(t,{ignore:["CollectionDate","CollectionDateReturn"],include:["EmailQuoteAddress"]});$.ajax({url:"/quote/_sendquoteemail",type:"POST",contentType:"application/json",data:i,success:function(){$("#quoteForm").css("display","none");$("#quoteEmailSuccess").css("display","block");try{f===!1&&(f=!0,fbq("track","Email entered on quote"))}catch(n){}},error:function(){$("#quoteForm").css("display","none");$("#quoteEmailFail").css("display","block")}})});r=0;$(window).on("scroll",function(){r=$(window).scrollTop()});i=!1;setTimeout(function(){$(window).on("mousemove",t.OnMouseMove)},5e3);t.OnMouseMove=function(n){if(t.ForceBookNow()!==!0&&$(window).width()>780){var u=n.pageY-r;u<=50&&!i&&t.IsFormReady()&&(i=!0,openPopup("#dialog-email-quote"),$(window).off("mousemove",t.OnMouseMove))}};t.BookNow=function(n){return(i=!0,t.CustomerPriceGroupId()===1&&t.ForceBookNow()!==!0)?(t.FormToSubmit(n),t.ForceBookNow(!0),forms.loadFormDialog("#popup-dynamic-container","/quote/_studentquotewarningdialog",{},forms.makeAjaxForm,"#popup-dynamic-container"),!1):!0}}};var orderSummaryLoaded=function(n){$("#order-summary").html(n)},orderSummaryLoadError=function(){$("#order-summary").html("We're sorry, it appears there was an error loading the order summary.")},_AddressFormViewModel=function(n,t,r){var u=this,f=$("#dialog-select-address");ko.mapping.fromJSON(n,{},u);Utilities.log(n);u._LoadingCities=ko.observable(!1);u.CitySelect=ko.observable(u.City());u.CitySelectVisible=ko.observable(!1);u.CitySelectEnabled=ko.observable(!0);u.ContactNameWarning=ko.observable(!1);u.RegionSelectEnabled=ko.observable(!0);u.ProvinceName=ko.observable("");u.BuzzerOrEntryCode=ko.observable("false");u._AddressSearchResults=ko.observableArray().extend({rateLimit:50});u.ActiveAddressType=ko.observable(null);u.Parent=ko.observable(null);u.PostcodeAnywhereKey=r;u.IsAddressTypeSelected=ko.computed(function(){return u.ActiveAddressType()?!0:!1});u.IsFieldVisible=function(n){return u.ActiveAddressType()?(n&u.ActiveAddressType().ShowFieldFlags())!=0:!1};u.FieldName=function(n,t){if(u.ActiveAddressType()&&u.ActiveAddressType().OverwriteFieldNames()&&u.ActiveAddressType().OverwriteFieldNames().length>0)for(i=0;i<u.ActiveAddressType().OverwriteFieldNames().length;i++)if((n&u.ActiveAddressType().OverwriteFieldNames()[i].FieldToOverwrite())!=0)return u.ActiveAddressType().OverwriteFieldNames()[i].OverwriteTextMapped();return t};u.AddressTypeMessage=ko.computed(function(){return u.ActiveAddressType()?u.ActiveAddressType().Message():""});u.HasBuzzerOrEntryCode=ko.computed(function(){u.PackageLocation()&&u.PackageLocation().length>0&&u.BuzzerOrEntryCode("true")});u.IsAddressComplete=ko.computed(function(){return!u.CountryIso()||!u.CountryIso().length?!1:u.CountryUsesPostcode()&&(!u.Postcode()||!u.Postcode().length)?!1:!u.City()||!u.City().length?!1:!0});u.ContactName.subscribe(function(){/\b\w{1,2}\b/.test(u.ContactName())?u.ContactNameWarning(!0):u.ContactNameWarning(!1)});u.CitySelect.subscribe(function(){u.CitySelectVisible()&&u.City(u.CitySelect())});u.CountryUsesPostcode.subscribe(function(){u.CountryUsesPostcode()||u.Postcode("-")});u.Postcode.subscribe(function(){u.PostcodeChange()});u.ProvinceName.subscribe(function(){u.ProvinceNameChange()});u.ProvinceNameChange=function(){if(u.CountryUsesRegions()&&u.ProvinceName()&&u.ProvinceName().length>0){var n=$("#"+t+"RegionId"),r=u.ProvinceName().toLowerCase(),i="";n.find("option").each(function(){if($(this).text().toLowerCase()===r)return i=$(this).val(),!1});n.select2("val",i);u.Parent()&&u.Parent().reloadOrderSummary()}};u.PostcodeChange=function(){if(u.CountryUsesPostcode()&&u.Postcode()&&u.Postcode().length>0&&!Utilities.validatePostcodeFormat(u.Postcode(),u.CountryPostcodeFormat())){$("#"+t+"Postcode").addClass("custom-input-validation-error");$('.custom-validation-message[data-for="'+t+'Postcode"]').show();return}$("#"+t+"Postcode").removeClass("custom-input-validation-error");$('.custom-validation-message[data-for="'+t+'Postcode"]').hide();u.updateCities()};u.updateCities=function(){var n=$("#"+t+"City_select"),r,i,f;if(n.empty().append('<option selected="selected" value=""><\/option>'),r=$("#"+t+"RegionId_select"),u.UsePostcodeLookup()){u.CitySelectVisible(!1);u.CitySelectEnabled(!0);return}if((!u.Postcode()||!u.Postcode().length)&&u.CountryUsesPostcode()){u.CitySelectVisible(!1);u.CitySelectEnabled(!1);return}u._LoadingCities(!0);u.CitySelectVisible(!1);u.CitySelectEnabled(!1);u.RegionSelectEnabled(!1);i=u.City();u.City("");f={countryIso:u.CountryIso(),postcode:u.Postcode()};Utilities.log("getting cities...",Utilities.LOGLEVEL.INFO);Utilities.log(f,Utilities.LOGLEVEL.INFO);$.ajax({url:"/country/getcities",type:"POST",data:f,success:function(t){var s,f,o,e;Utilities.log("...getting cities success",Utilities.LOGLEVEL.INFO);s={target:n};Utilities.populateSelect.call({customParams:s},t,"Name","Name",{value:"",text:""});f=t.length||0;u.CitySelectVisible(f>1);u.CitySelectEnabled(f!==1);f===1?u.City(t[0].Name):f===0?(u.CitySelect(""),n.select2("val","")):n.find("option[value='"+i+"']").length>0?(u.CitySelect(i),n.select2("val",i)):(u.City(""),u.CitySelect(""),n.select2("val",""));u.CountryUsesRegions()&&(o=!0,f>0&&(e=r.find("option[data-code='"+t[0].CountryDivisionCode+"']"),e.length>0&&(u.RegionId(e.val()),r.select2("val",e.val()),o=!1)),u.RegionSelectEnabled(o))},error:function(){Utilities.log("...getting cities failed",Utilities.LOGLEVEL.INFO);u.CitySelectVisible(!1);u.CitySelectEnabled(!0);u.RegionSelectEnabled(!0)},complete:function(){u._LoadingCities(!1);u.Parent()&&u.Parent().reloadOrderSummary()}})};u.CapturePlus_Find=function(n,t,i){f.addClass("is-loading");$.getJSON("https://services.postcodeanywhere.co.uk/CapturePlus/Interactive/Find/v2.00/json3.ws?callback=?",{Key:u.PostcodeAnywhereKey,SearchTerm:n,LastId:t,SearchFor:"PostalCodes",Country:i,LanguagePreference:"EN"},u.CapturePlus_Find_Success)};u.CapturePlus_Find_Success=function(n){if(f.removeClass("is-loading"),Utilities.log(n.Items),n.Items.length===1&&typeof n.Items[0].Error!="undefined")Utilities.log(n.Items[0].Description);else if(n.Items.length===0)Utilities.log("Sorry, there were no results");else if(u._AddressSearchResults.removeAll(),n.Items.length===1)u.selectAddress(n.Items[0]);else for(var t=0;t<n.Items.length;t++)u._AddressSearchResults.push(n.Items[t])};u.CapturePlus_Retrieve=function(n){$.getJSON("https://services.postcodeanywhere.co.uk/CapturePlus/Interactive/Retrieve/v2.00/json3.ws?callback=?",{Key:u.PostcodeAnywhereKey,Id:n},function(n){if(Utilities.log(n.Items),n.Items.length==1&&typeof n.Items[0].Error!="undefined")Utilities.log(n.Items[0].Description);else if(n.Items.length==0)Utilities.log("Sorry, there were no results");else{u.Postcode(n.Items[0].PostalCode);var i=n.Items[0].Line1,t="";n.Items[0].Line5&&n.Items[0].Line5.length?(i+=", "+n.Items[0].Line2,t=n.Items[0].Line3+", "+n.Items[0].Line4+", "+n.Items[0].Line5):n.Items[0].Line4&&n.Items[0].Line4.length?(i+=", "+n.Items[0].Line2,t=n.Items[0].Line3+", "+n.Items[0].Line4):n.Items[0].Line3&&n.Items[0].Line3.length?n.Items[0].Line1.length+n.Items[0].Line2.length<34?(i+=", "+n.Items[0].Line2,t=n.Items[0].Line3):t=n.Items[0].Line2+", "+n.Items[0].Line3:t=n.Items[0].Line2;u.Line1(i);u.Line2(t);u.City(n.Items[0].City);u.CompanyName(n.Items[0].Company);u.ProvinceName(n.Items[0].ProvinceName)}})};u.findAddress=function(){u._AddressSearchResults.removeAll();u.Parent()&&u.Parent()._Address(u);openPopup("#dialog-select-address");u.CapturePlus_Find(u.Postcode(),null,u.CountryIso().slice(0,2))};u.selectAddress=function(n){n.Next==="Retrieve"?(u.CapturePlus_Retrieve(n.Id),$.magnificPopup.close({items:{src:"#dialog-select-address"}})):n.Next==="Find"&&u.CapturePlus_Find(n.Text,n.Id,u.CountryIso().slice(0,2))};u.AddressTypeId.subscribe(function(){var t=!1,n;if(u.AddressTypeId()&&(n=parseInt(u.AddressTypeId()),n>0))for(i=0;i<u.AddressTypes().length;i++)if(parseInt(u.AddressTypes()[i].Id())===n){u.ActiveAddressType(u.AddressTypes()[i]);t=!0;break}t!==!0&&u.ActiveAddressType(null)});u.CitySelect(u.City());u.PostcodeChange()},_StepAddressesViewModel=function(n,t){var i=this;i.bindAddress=ko.observable(!0);i.Summary=t;i.Address=n;i.Address.Parent(i);i.GettingRouteAlerts=ko.observable(!1);i.CapabilityCheckFailed=ko.observable(!1);i.GettingCapability=ko.observable(!1);i._TriggerCapabilityCheck=ko.observable(!1);i._Address=ko.observable(i.Address);i.IsNextEnabled=ko.computed(function(){return!0});i.Address.RegionId.subscribe(function(){i.reloadOrderSummary()});i.reloadOrderSummary=function(){if(i.Address.CountryIso().length){$("#order-summary-container").addClass("is-loading");var n=ko.mapping.toJSON(i.Address,{ignore:["AddressTypes","UsePostcodeLookup","CountryPostcodeFormat","BuzzerOrEntryCode","CountryUsesCompanyName","CountryUsesRegions","CountryUsesPostcode"]});Utilities.log("update Order Summary...",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);$.ajax({url:i.Summary,type:"POST",contentType:"application/json",data:n,success:orderSummaryLoaded,error:orderSummaryLoadError,complete:function(){$("#order-summary-container").removeClass("is-loading")}})}};i.selectAddress=function(n){return i._Address().selectAddress(n)}},_StepConfirmAddressesViewModel=function(n){var t=this;ko.mapping.fromJSON(n,{},t);Utilities.log(n);t.GettingRouteAlerts=ko.observable(!1);t.IsNextEnabled=ko.computed(function(){return t.ErrorMessage()&&t.ErrorMessage().length>0?!1:!0});t.JourneyType.subscribe(function(){t.reloadOrderSummary()});t.reloadOrderSummary=function(){$("#order-summary-container").addClass("is-loading");var n=ko.mapping.toJSON(t,{ignore:[]});Utilities.log("update Order Summary...",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);$.ajax({url:"/order/_ordersummarystepconfirmaddresses",type:"POST",contentType:"application/json",data:n,success:orderSummaryLoaded,error:orderSummaryLoadError,complete:function(){$("#order-summary-container").removeClass("is-loading")}})}},_StepBagsViewModel=function(n){var t=this;ko.mapping.fromJSON(n,{},t);t.GettingRouteAlerts=ko.observable(!1);t.NewBag.BagTypeDescription=ko.observable("");t.AddingBag=ko.observable(!1);t.ShowCustomsValueWarningThreshold=ko.observable(!0);t.ShowCopyDialog=ko.observable(!1);t.ConfirmCopyDialogBag=ko.observable("");t.IsNextEnabled=ko.computed(function(){return t.Bags().length>0?!0:!1});t.NewBag.VolumetricWeight=ko.computed(function(){var n=t.NewBag.Width()||0,i=t.NewBag.Height()||0,r=t.NewBag.Length()||0;return Utilities.calculateVolumetricWeight(n,i,r)});t.NewBag.IsCentimeters=ko.computed(function(){return t.NewBag.LengthUnit()!=null&&t.NewBag.LengthUnit().toString().toLowerCase()==="inches"?!1:!0});t.NewBag.IsKilograms=ko.computed(function(){return t.NewBag.IsCentimeters()});t.NewBag.MaxLengthInUnits=ko.computed(function(){return t.NewBag.IsCentimeters()?t.NewBag.MaxLength():parseFloat((t.NewBag.MaxLength()/2.54).toFixed(1))});t.NewBag.MaxWeightInUnits=ko.computed(function(){return t.NewBag.IsKilograms()?t.NewBag.MaxWeight():parseFloat((t.NewBag.MaxWeight()*2.20462).toFixed(1))});t.NewBag.IsWidthValid=ko.computed(function(){return t.NewBag.Width()<=t.NewBag.MaxLengthInUnits()?($('.custom-validation-message[data-for="Width"]').hide(),!0):($('.custom-validation-message[data-for="Width"]').show(),!1)});t.NewBag.IsHeightValid=ko.computed(function(){return t.NewBag.Height()<=t.NewBag.MaxLengthInUnits()?($('.custom-validation-message[data-for="Height"]').hide(),!0):($('.custom-validation-message[data-for="Height"]').show(),!1)});t.NewBag.IsLengthValid=ko.computed(function(){return t.NewBag.Length()<=t.NewBag.MaxLengthInUnits()?($('.custom-validation-message[data-for="Length"]').hide(),!0):($('.custom-validation-message[data-for="Length"]').show(),!1)});t.NewBag.IsWeightValid=ko.computed(function(){return t.NewBag.EnteredWeight()<=t.NewBag.MaxWeightInUnits()?($('.custom-validation-message[data-for="EnteredWeight"]').hide(),!0):($('.custom-validation-message[data-for="EnteredWeight"]').show(),!1)});t.addBag=function(){var n=$("#bag-form"),r,i;return n&&n.valid()&&t.validateDimensions()&&t.validateVolumetricWeight()&&(t.AddingBag(!0),r={},i=ko.mapping.toJSON(t.NewBag,r),Utilities.log("adding bag...",Utilities.LOGLEVEL.INFO),Utilities.log(i,Utilities.LOGLEVEL.INFO),$.ajax({url:"/order/_addbag",type:"POST",contentType:"application/json",data:i,success:function(n){if(Utilities.log("...complete (adding bag)",Utilities.LOGLEVEL.INFO),Utilities.log(n,Utilities.LOGLEVEL.INFO),Utilities.log("-",Utilities.LOGLEVEL.INFO),n.id){t.NewBag.Id(n.id);var i=cloneObservable(t.NewBag);t.Bags.push(i);t.clearBagValues(t.NewBag);t.reloadOrderSummary();t.checkOversize(i)}else n.error!=null&&n.error.length&&showModalWindow(n.error)},error:function(){},complete:function(){n.removeClass("submitting");t.AddingBag(!1)}})),!1};t.validateVolumetricWeight=function(){return t.NewBag.VolumetricWeight()>t.NewBag.MaxWeight()?(showModalWindow("VOLUMETRIC_WEIGHT_TOO_BIG"),!1):!0};t.validateDimensions=function(){return t.NewBag.IsWidthValid()?t.NewBag.IsHeightValid()?t.NewBag.IsLengthValid()?t.NewBag.IsWeightValid()?!0:($("#EnteredWeight").focus(),!1):($("#Length").focus(),!1):($("#Height").focus(),!1):($("#Width").focus(),!1)};t.removeBag=function(n){var i={bagId:n.Id()};return Utilities.log("remove bag...",Utilities.LOGLEVEL.INFO),Utilities.log(i,Utilities.LOGLEVEL.INFO),$.ajax({url:"/order/_removebag",type:"POST",data:i,success:function(i){Utilities.log("...complete (remove bag)",Utilities.LOGLEVEL.INFO);Utilities.log(i,Utilities.LOGLEVEL.INFO);Utilities.log("-",Utilities.LOGLEVEL.INFO);i.id&&(t.Bags.remove(n),t.reloadOrderSummary())},error:function(){},complete:function(){}}),!1};t._copyBag=function(n){if(!t.copyDialogIsShown(n)){var i={bagId:n.Id()};return Utilities.log("copy bag...",Utilities.LOGLEVEL.INFO),Utilities.log(i,Utilities.LOGLEVEL.INFO),$.ajax({url:"/order/_copybag",type:"POST",data:i,success:function(n){Utilities.log("...complete (copy bag)",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);Utilities.log("-",Utilities.LOGLEVEL.INFO);n.bag!=null&&(t.Bags.push(cloneObservable(n.bag)),t.reloadOrderSummary())},error:function(){},complete:function(){}}),!1}};t.copyBag=function(n){t._copyBag(n)};t.ConfirmDialogCopyBag=function(){t.ShowCopyDialog(!0);t._copyBag(t.ConfirmCopyDialogBag())};t.copyDialogIsShown=function(n){return t.ShowCopyDialog()?!1:(t.ConfirmCopyDialogBag(n),openModalPopup("#dialog-copy-info"),!0)};t.clearBagValues=function(n){n.Width(null);n.Height(null);n.Length(null);n.EnteredWeight(null);n.Name(null);n.BagTypeId("")};t.CustomsValue.subscribe(function(){t.ShowCustomsValueWarningThreshold()&&t.CustomsValue()>t.CustomsValueWarningThreshold()&&showModalWindow("CUSTOMS_VALUE")});t.IsCurrencyChanged=ko.computed(function(){if(t.IsCurrencyChanged())return showModalWindow("CURRENCY_CHANGED"),!1});t.NewBag.BagTypeId.subscribe(function(){t.NewBag.BagTypeDescription($("#BagTypeId").find(":selected").data("description"))});t.clearBagValues(t.NewBag);t.reloadOrderSummary=function(){$("#order-summary-container").addClass("is-loading");var n=ko.mapping.toJSON(t,{ignore:["Bags","NewBag","CustomsValue","CustomsInvoiceRequired","CustomsValueWarningThreshold","CustomsValueMin","CustomsValueMax","CurrencyCode","IsCurrencyChanged","IsSelfClearanceDestination","ClearanceMethod","ShowAdditionalClearanceOptions","IsAdmin"]});Utilities.log("update Order Summary...",Utilities.LOGLEVEL.INFO);$.ajax({url:"/order/_ordersummarystepbags",type:"POST",contentType:"application/json",data:n,success:orderSummaryLoaded,error:orderSummaryLoadError,complete:function(){$("#order-summary-container").removeClass("is-loading")}})};t.ClearanceMethod.subscribe(function(){var n=$("input[name=ClearanceMethod]:checked"),i=n.closest("form");i.removeData("validator");$("#CustomsValue").attr("data-val-range-max",n.data("customs-val-range-max")).attr("data-val-range",n.data("customs-val-range"));n.data("show-customs-val-warning-threshold")=="1"?t.ShowCustomsValueWarningThreshold(!0):t.ShowCustomsValueWarningThreshold(!1);$.validator.unobtrusive.parse(document);$("#CustomsValue").val().length>0&&i.valid()});t.showAdditionalClearanceOptions=function(){t.ShowAdditionalClearanceOptions(!0)};t.ChargePhoneOrderFee.subscribe(function(){var n=$("input:checkbox[name=ChargePhoneOrderFee]"),i=n.closest("form");i.removeData("validator");$("#WaivePhoneOrderFeeReason").attr("data-val",t.ChargePhoneOrderFee()?"false":"true");$.validator.unobtrusive.parse(document);t.reloadOrderSummary()});t.checkOversize=function(n){(n.Length()>t.OversizeWarningMin()-1&&n.Length()<t.OversizeWarningMax()||n.Width()>t.OversizeWarningMin()-1&&n.Width()<t.OversizeWarningMax()||n.Height()>t.OversizeWarningMin()-1&&n.Height()<t.OversizeWarningMax())&&openModalPopup("#dialog-oversize-warning")}},_StepDatesViewModel=function(n){var t=this,i=!1,f=$("#estimated-date-message"),e=$("#estimated-date-return-message"),u,r;ko.mapping.fromJSON(n,{},t);Utilities.log(n);t.GettingDeliveryDate=ko.observable(!1);t.GettingDeliveryDateReturn=ko.observable(!1);t.GettingRouteAlerts=ko.observable(!1);t.ShowDateNotSetByCourier=ko.observable(!1);t.ShowDateNotSetByCourierReturn=ko.observable(!1);t.IsDateAvailable=ko.observable(!0);t.IsReturnDateAvailable=ko.observable(!0);t.HideTimeslots=ko.observable(t.HasRestrictedDate());t.HideTimeslotsReturn=ko.observable(t.HasRestrictedDateReturn());$(".ui-datepicker-current-day .ui-state-hover").removeClass("ui-state-hover");u=function(n,t){this.SelectValue=n;this.SelectText=t};t.AvailableTimeslotsOptions=ko.observableArray();t.AvailableTimeslotsOptionsReturn=ko.observableArray();t.PublicHolidays=ko.observableArray();t.PublicHolidaysReturn=ko.observableArray();t.CountryWeekend=ko.observableArray();t.CountryWeekendReturn=ko.observableArray();t.IsNextEnabled=ko.computed(function(){return t.IsDateAvailable()&&t.IsReturnDateAvailable()});r="T12:00:00-00:00";t.CollectionDateFormatted=ko.computed({read:function(){return t.CollectionDate()?moment.utc(t.CollectionDate()).format("DD/MM/YYYY"):null},write:function(n){t.CollectionDate(moment.utc(n+r,"DD/MM/YYYY HH:mm").toDate())}});t.CollectionDateReturnFormatted=ko.computed({read:function(){return t.CollectionDateReturn()?moment.utc(t.CollectionDateReturn()).format("DD/MM/YYYY"):null},write:function(n){t.CollectionDateReturn(moment.utc(n+r,"DD/MM/YYYY HH:mm").toDate())}});t.EstimatedDateFormatted=ko.computed(function(){return t.DeliveryDate()===null?"":t.MaxEstimatedDeliveryDate()===null||moment.utc(t.DeliveryDate()).format("Do MMMM YYYY")===moment.utc(t.MaxEstimatedDeliveryDate()).format("Do MMMM YYYY")?moment.utc(t.DeliveryDate()).format("Do MMMM YYYY"):moment.utc(t.DeliveryDate()).format("Do MMMM YYYY")+" / "+moment.utc(t.MaxEstimatedDeliveryDate()).format("Do MMMM YYYY")});t.EstimatedDateReturnFormatted=ko.computed(function(){return t.DeliveryDateReturn()===null?"":t.MaxEstimatedDeliveryDateReturn()===null||moment.utc(t.DeliveryDateReturn()).format("Do MMMM YYYY")===moment.utc(t.MaxEstimatedDeliveryDateReturn()).format("Do MMMM YYYY")?moment.utc(t.DeliveryDateReturn()).format("Do MMMM YYYY"):moment.utc(t.DeliveryDateReturn()).format("Do MMMM YYYY")+" / "+moment.utc(t.MaxEstimatedDeliveryDateReturn()).format("Do MMMM YYYY")});t.IsDateSelected=ko.computed(function(){return t.CollectionDate()?!0:!1});t.IsReturnDateSelected=ko.computed(function(){return t.CollectionDateReturn()?!0:!1});t.getEstimatedDates=function(n,i){(Utilities.log("getting estimated date...",Utilities.LOGLEVEL.INFO),Utilities.log(n,Utilities.LOGLEVEL.INFO),i===1||t.JourneyType()===2)&&$.ajax({url:"/quote/getestimateddatefrombasket",type:"POST",contentType:"application/json",data:n,success:function(n){if(Utilities.log("...complete",Utilities.LOGLEVEL.INFO),Utilities.log(n,Utilities.LOGLEVEL.INFO),Utilities.log("-",Utilities.LOGLEVEL.INFO),i===1?(t.IsDateAvailable(!0),t.DeliveryDate(moment.utc(n.EstimatedDeliveryDate)),t.MaxEstimatedDeliveryDate(moment.utc(n.MaxEstimatedDeliveryDate)),t.PublicHolidays(n.PublicHolidays),f.html(n.EstimatedDateMessage)):(t.IsReturnDateAvailable(!0),t.DeliveryDateReturn(moment.utc(n.EstimatedDeliveryDate)),t.MaxEstimatedDeliveryDateReturn(moment.utc(n.MaxEstimatedDeliveryDate)),t.PublicHolidaysReturn(n.PublicHolidays),e.html(n.EstimatedDateMessage)),n){var r=!1;if(n.IsBlockingError)switch(n.ErrorType){case 3:i===1?(t.IsDateAvailable(!1),$("#modal-content").html("We're sorry, the collection date you selected is unavailable, please choose a different day.")):(t.IsReturnDateAvailable(!1),$("#modal-content").html("We're sorry, the collection date you selected for your return journey is unavailable, please choose a different day."));openPopup("#dialog-error");r=!0}r||(n.IsDeliveryDateSetByCourier||(i===1?t.ShowDateNotSetByCourier(!0):t.ShowDateNotSetByCourierReturn(!0)),n.Information&&n.Information.length&&($("#info-popup-content").html(n.Information),openModalPopup("#dialog-info")));try{n.HasRestrictedPickupDate?i===1?(t.CollectionTimeRange(t.AvailableTimeslotsOptions()[0].SelectValue),t.HideTimeslots(!0)):(t.CollectionTimeRangeReturn(t.AvailableTimeslotsOptionsReturn()[0].SelectValue),t.HideTimeslotsReturn(!0)):i===1?t.HideTimeslots(!1):t.HideTimeslotsReturn(!1)}catch(u){}}},complete:function(){i===1?t.GettingDeliveryDate(!1):t.GettingDeliveryDateReturn(!1)}})};t.updateAvailableCollectionSlots=function(){t._updateAvailableCollectionSlots(t.CollectionTimeRange,t.AvailableTimeslots(),t.AvailableTimeslotsOptions);t._updateAvailableCollectionSlots(t.CollectionTimeRangeReturn,t.AvailableTimeslotsReturn(),t.AvailableTimeslotsOptionsReturn)};t._updateAvailableCollectionSlots=function(n,i,r){var f,e;if(i&&i.length)for(f=n(),r.removeAll(),index=0;index<i.length;++index)if(i[index].DeliveryMethodType()===t.DeliveryMethodType()){for(optionIndex=0;optionIndex<i[index].AvailableTimeslots().length;++optionIndex)e=new u(i[index].AvailableTimeslots()[optionIndex].Value(),i[index].AvailableTimeslots()[optionIndex].Text()),r.push(e),e.SelectValue===f&&n(f);break}};t.getEstimatedDate=function(){if(t.CollectionDate()){t.GettingDeliveryDate(!0);t.ShowDateNotSetByCourier(!1);var n=ko.mapping.toJSON(t,{ignore:["CollectionDateReturn","JourneyType","DeliveryDate","DeliveryDateReturn"]});t.getEstimatedDates(n,1)}};t.getEstimatedReturnDate=function(){var i,n,r,u;t.CollectionDateReturn()&&(t.GettingDeliveryDateReturn(!0),t.ShowDateNotSetByCourierReturn(!1),i={ignore:["CollectionDate","JourneyType","DeliveryDate","DeliveryDateReturn"]},n=ko.mapping.toJS(t,i),n.CollectionDate=n.CollectionDateReturn,r=n.Origin,n.Origin=n.Destination,n.Destination=r,u=ko.mapping.toJSON(n),t.getEstimatedDates(u,2))};t.CollectionDate.subscribe(function(n){if(t.getEstimatedDate(),n){var i=moment(n).add(1,"days").format("DD/MM/YYYY");$("#CollectionDateReturn").datepicker("option","minDate",i)}});t.CollectionDateReturn.subscribe(function(){t.getEstimatedReturnDate()});t.DeliveryMethodType.subscribe(function(){t.updateAvailableCollectionSlots();t.getEstimatedDate();t.getEstimatedReturnDate();t.reloadOrderSummary()});t.CollectionTimeRange.subscribe(function(){!i&&t.CollectionTimeRange()&&t.CollectionTimeRange()!=="09:00-18:00"&&t.AvailableTimeslotsOptions().length>1&&(i=!0,openModalPopup("#dialog-collectionslottrial"))});t.CollectionTimeRangeReturn.subscribe(function(){!i&&t.CollectionTimeRangeReturn()&&t.CollectionTimeRangeReturn()!=="09:00-18:00"&&t.AvailableTimeslotsOptionsReturn().length>1&&(i=!0,openModalPopup("#dialog-collectionslottrial"))});t.reloadOrderSummary=function(){$("#order-summary-container").addClass("is-loading");var n=ko.mapping.toJSON(t,{ignore:[]});Utilities.log("update Order Summary...",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);$.ajax({url:"/order/_ordersummarystepdates",type:"POST",contentType:"application/json",data:n,success:orderSummaryLoaded,error:orderSummaryLoadError,complete:function(){$("#order-summary-container").removeClass("is-loading")}})};t.updateAvailableCollectionSlots()},_Step4ViewModel=function(n,t){var i=this;ko.mapping.fromJSON(n,{},i);Utilities.log(n);i.Address=t;i.Address.Parent(i);i._Address=ko.observable(i.Address);i.GettingRouteAlerts=ko.observable(!1);i.Purpose1SubType=ko.observable(0);i.Purpose1Description=ko.observable("");i.PostageMethodId()!=null&&i.PostageMethodId(i.PostageMethodId().toString());i.UseCollectionAddressForDelivery()!=null&&i.UseCollectionAddressForDelivery(i.UseCollectionAddressForDelivery().toString().toLowerCase());i.PostLabelHolders()!=null&&i.PostLabelHolders(i.PostLabelHolders().toString());i.PostLabels()!=null&&i.PostLabels(i.PostLabels().toString().toLowerCase());i.BuyCancellationCover()!=null&&i.BuyCancellationCover(i.BuyCancellationCover().toString().toLowerCase());i.IsNextEnabled=ko.computed(function(){return!0});i.RequiresDeliveryAddress=ko.computed(function(){return safeBool(i.PostLabels())?!0:i.PostLabelHolders()>0?!0:!1});ko.computed(function(){safeBool(i.PostLabels())||i.PostLabelHolders()&&i.PostLabelHolders()!=0||i.PostageMethodId(null)});i.Purpose1Id.subscribe(function(){var n=$("#Purpose1Id").find(":selected");i.Purpose1SubType(n.data("subtype"));i.Purpose1Description(n.data("description"))});i.PostageMethodId.subscribe(function(){var n=$("input[name=PostageMethodId]:checked"),t;i.PostageMethodId()&&n&&(t=n.data("showwarning"),t&&openPopup("#dialog-postage-cutoff"))});ko.computed(function(){$("#order-summary-container").addClass("is-loading");var n=ko.mapping.toJSON(i,{ignore:["UseCollectionAddressForDelivery","DeliveryAddress","Purpose1Id","Purpose1SubType","Purpose1Description","UniversityId"]});Utilities.log("update Order Summary...",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);$.ajax({url:"/order/_ordersummarystepextras",type:"POST",contentType:"application/json",data:n,success:orderSummaryLoaded,error:orderSummaryLoadError,complete:function(){$("#order-summary-container").removeClass("is-loading")}})});i.selectAddress=function(n){return i._Address().selectAddress(n)}},_RegisterViewModel=function(n){var t=this;ko.mapping.fromJSON(n,{},t);Utilities.log(n);t.Purpose1SubType=ko.observable(0);t.Purpose1Description=ko.observable("");t.Purpose1Id.subscribe(function(){var n=$("#Purpose1Id").find(":selected");t.Purpose1SubType(n.data("subtype"));t.Purpose1Description(n.data("description"))})},_StepConfirmViewModel=function(n){var t=this;ko.mapping.fromJSON(n,{},t);Utilities.log(n);t.YourName=ko.observable("");t.IsRegistered=ko.observable("false");t.Email=ko.observable("");t.ConfirmEmail=ko.observable("");t.Number=ko.observable();t.IsNextEnabled=ko.computed(function(){return!0});t.Email.subscribe(function(){t.IsRegistered()==="true"&&t.ConfirmEmail(t.Email())});t.IsRegistered.subscribe(function(){t.IsRegistered()==="true"?(t.YourName("------"),t.Number("000000000")):(t.YourName(""),t.Number(""))})},_PackingListViewModel=function(n){var t=this;ko.mapping.fromJSON(n,{},t);t.IsSaving=ko.observable(!1);t.HideSendersNameRequiredError=ko.observable(!1);t.CurrencySymbol=ko.computed(function(){return t.CurrencyCode(),$("#CurrencyCodeSelect").find(":selected").data("symbol")});t.TotalValue=ko.computed(function(){for(var i=0,n=0;n<t.InvoiceItems().length;n++)i+=parseFloat(t.InvoiceItems()[n].unit_value())*parseFloat(t.InvoiceItems()[n].no_of_units());return i});t.DifferenceToTargetValue=ko.computed(function(){return parseFloat(parseFloat(t.TargetValue()-t.TotalValue()).toFixed(2))});t.MultiplierToTargetValue=ko.computed(function(){return parseFloat(t.TotalValue())!==0?parseFloat(t.TargetValue()/t.TotalValue()):1});t.TotalQuantity=ko.computed(function(){for(var i=0,n=0;n<t.InvoiceItems().length;n++)i+=parseInt(t.InvoiceItems()[n].no_of_units());return i});t.adjustValuesToMatchTarget=function(){var e=t.MultiplierToTargetValue(),i=t.DifferenceToTargetValue(),f,u,n,r;if(e>0&&(i<-.01||i>.01))for(n=0;n<t.InvoiceItems().length;n++)r=parseFloat(Math.max(.01,parseFloat(t.InvoiceItems()[n].unit_value())*e).toFixed(2)),t.InvoiceItems()[n].unit_value(r);if(i=t.DifferenceToTargetValue(),t.TotalQuantity()>0&&t.TotalQuantity()<=Math.abs(i)*100&&(i<-.01||i>.01))for(u=parseFloat(parseFloat(i/t.TotalQuantity()).toFixed(2)),n=0;n<t.InvoiceItems().length;n++)r=parseFloat(Math.max(.01,parseFloat(t.InvoiceItems()[n].unit_value())+u).toFixed(2)),t.InvoiceItems()[n].unit_value(r);for(f=0;f<3;f++){if(i=t.DifferenceToTargetValue(),Math.abs(t.DifferenceToTargetValue())<.005)break;for(u=i>0?.01:-.01,n=0;n<t.InvoiceItems().length;n++)if(Math.abs(t.DifferenceToTargetValue())*100>=t.InvoiceItems()[n].no_of_units()&&(r=parseFloat(Math.max(.01,parseFloat(t.InvoiceItems()[n].unit_value())+u).toFixed(2)),t.InvoiceItems()[n].unit_value(r),Math.abs(t.DifferenceToTargetValue())<.005))break}};t.addItem=function(){t.InvoiceItems.push({no_of_units:ko.observable(t.NewInvoiceItem.no_of_units()),unit_of_measure:ko.observable(t.NewInvoiceItem.unit_of_measure()),description_of_goods:ko.observable(t.NewInvoiceItem.description_of_goods()),country_of_origin:ko.observable(t.NewInvoiceItem.country_of_origin()),unit_value:ko.observable(t.NewInvoiceItem.unit_value())});t.NewInvoiceItem.no_of_units(1);t.NewInvoiceItem.unit_of_measure("Piece");t.NewInvoiceItem.description_of_goods("");t.NewInvoiceItem.unit_value(0)};t.removeItem=function(n){t.InvoiceItems.remove(n)};t._save=function(n){if((n===!0||!t.hasUnsavedForm())&&!t.packingListItemsIsValid()&&!t.packingListCount(n)&&!t.packingListValueIsValid()&&t.sendersNameIsValid()){t.IsSaving(!0);var i=ko.mapping.toJSON(t);Utilities.log("saving...",Utilities.LOGLEVEL.INFO);Utilities.log(i,Utilities.LOGLEVEL.INFO);$.ajax({url:"/account/createpackinglist",type:"POST",contentType:"application/json",data:i,success:function(n){Utilities.log("...complete (saving)",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);Utilities.log("-",Utilities.LOGLEVEL.INFO);n.url?window.location=n.url:n.error&&($("#create-packing-list-container").css("display","none"),$("#error-container").css("display","block"))},error:function(){$("#create-packing-list-container").css("display","none");$("#error-container").css("display","block")},complete:function(){t.IsSaving(!1)}})}};t.save=function(){t._save(!1)};t.SaveWithoutCheckingChanges=function(){t._save(!0)};t.AutoAdjustAndSave=function(){t.adjustValuesToMatchTarget();t._save(!0)};t.hasUnsavedForm=function(){return t.NewInvoiceItem.description_of_goods()&&t.NewInvoiceItem.description_of_goods().trim()!==""?(openModalPopup("#dialog-unsaved"),!0):!1};t.packingListItemsIsValid=function(){for(var n=0;n<t.InvoiceItems().length;n++)if(t.InvoiceItems()[n].unit_value()<=0)return openModalPopup("#dialog-error-value"),!0;return!1};t.packingListValueIsValid=function(){return t.DifferenceToTargetValue()>.01?(openModalPopup("#dialog-error-less"),!0):t.DifferenceToTargetValue()<-.01?(openModalPopup("#dialog-error-greater"),!0):!1};t.packingListCount=function(n){return t.InvoiceItems().length<3&&n!==!0?(openModalPopup("#dialog-error-count"),!0):!1};t.sendersNameIsValid=function(){return t.SendersName()?($("#SendersName").removeClass("input-validation-error"),t.HideSendersNameRequiredError(!1),!0):($("#SendersName").addClass("input-validation-error"),t.HideSendersNameRequiredError(!0),!1)}};(function(n,t,r){function e(n,i,r,u){var e,f;s(n,i);i.data("isallowed")==="no"?(i.val(null),i.removeAttr("checked")):i.is(":checkbox")&&!i.is(":checked")||(e=o.filter('[data-parent="'+n+'"]'),e.css("display","block"));f=r.data("selectedmessage");u&&f&&f.length&&(t("#modal-content").html(f),openPopup("#dialog-info"))}function s(n,i){var r=i.closest(".field-item"),f,u,e;r&&(i.is(":checkbox")?i.is(":checked")||(f=o.filter('[data-parent="'+n+'"]'),f.css("display","none")):(u=r.attr("data-oldvalue"),r.attr("data-oldvalue",n),u&&(e=o.filter('[data-parent="'+u+'"]'),e.each(function(){t(this).css("display","none");var n=t(this).find("input, textarea, select");n.each(function(){t(this).filter(":not([type=radio], [type=checkbox])").val(null);t(this).filter("input:checked").removeAttr("checked");s(t(this).data("answer"),t(this))})}))))}function f(n,i){var u=t(".repeatable").length,r=i;return i&&(!i.match(/^[a-z]|[A-Z]/g)||(i.match(/-/g)||[]).length>=2)&&(r=i.substring(0,i.lastIndexOf("-"))),r+"-"+u}var h={maxFilesize:4194304},u=t("#customs-form"),o=t(".has-parent");n.initialise=function(){var n=Handlebars.compile(t("#file-upload-template").html());u.submit(function(){return(t(".toggle-hide").show(),t(".fa-plus").removeClass("fa-plus").addClass("fa-minus"),u.validate(),u.valid())?!0:!1});u.on("change","input",function(){var n=t(this).attr("data-answer");n&&e(n,t(this),t(this),!0)});u.on("change","select",function(){e(t(this).find(":selected").data("answer"),t(this),t(this).find(":selected"),!0)});u.on("change","input:file",function(){var u=t(this),f=u.hasClass("multiple"),e,s,c,o;if(typeof FileReader!="undefined"){for(e=this.files.length,e===0&&(f==r||f==!1)&&u.parent("div").find(".images-to-upload table").empty(),i=0;i<e;i++)if(s=this.files[i].size,s>h.maxFilesize){t(this).val("");openPopup("#dialog-filesize");return}for(i=0;i<e;i++)c=this.files[i],o=new FileReader,o.onload=function(t){var i=n({fileName:"New image",file:t.target.result,hideDelete:f?"":"hide-input"});u.rules("remove","required");u.removeAttr("data-val");u.removeAttr("data-val-required");f!=r&&f!=!1?(u.css({display:"none"}),u.after('<input type="file" name="'+u.attr("name")+'" class="'+(f?"multiple":"")+'" />'),u.parent("div").find(".images-to-upload table").append(i),u.appendTo(u.parent("div").find(".images-to-upload table td:last"))):u.parent("div").find(".images-to-upload table").empty().append(i)},o.readAsDataURL(this.files[i])}});u.on("click",".preview-img",function(){openImagePopup(t(this).data("image"))});u.on("click",".icon-delete",function(){t(this).closest("tr").remove()});u.find("input:radio:checked").each(function(){var n=t(this).data("answer");n&&e(n,t(this),t(this),!1)});u.find("select option:selected").each(function(){e(t(this).data("answer"),t(this).closest("select"),t(this),!1)});u.find("input:checkbox:checked").each(function(){var n=t(this).data("answer");n&&e(n,t(this),t(this),!1)});u.on("click",".view-image",function(n){var i,r;n.preventDefault?n.preventDefault():n.returnValue=!1;i=t("#dialog-imagepreview");i.html("");r=t('<img src="'+t(this).data("href")+'" class="customs-image-preview" />').appendTo(i);openPopup("#dialog-imagepreview")});u.on("click",".btnAddInfo",function(){var n=t(this).data("question"),i='<div class="field-row"><div class="field-item"><input id="'+n+'" name= "'+n+'" type="text"/><\/div><\/div>';t(this).before(i)});u.on("click",".image-selectable",function(){var n=t(this).data("question"),i=t(this).attr("src"),r='<input id="'+n+'" name="'+n+'" value="'+i+'" type="hidden" class="image-input"  />';t(this).hasClass("selected")?(t(this).next().remove(),t(this).removeClass("selected")):(t(".image-preview").fadeOut("fast"),t(this).addClass("selected"),t(this).after(r))});u.on("click",".btnAddRepeatable",function(){var i=t(this),e=t(".repeatable").length,r=i.closest("section").find(".repeatable").first(),n=r.clone(!1);n.addClass("additional");n.append('<div class="field-row"><button type="button" class="btnDelete btn-standard right">Delete<\/button><\/div>');n.find("input:text").val("");n.find("input:file").val("");n.find(':input[type="number"]').val("");n.find("textarea").val("");n.find("input:radio, input:checkbox").prop("checked",!1);n.find("select").prop("selectedIndex",0).val("");n.find("option").removeAttr("selected");n.find("select").parent("div").find("input:hidden").remove();n.find(".existing-to-delete").remove();n.find("table").empty();n.find(".has-parent").css("display","none");n.find(".datepicker-custom").removeClass("hasDatepicker");n.find("input, select, textarea").attr({id:f,name:f}).removeAttr("readonly").removeAttr("disabled").removeAttr("onclick");n.find("input[data-answer]").attr("data-answer",f);n.find("option[data-answer]").attr("data-answer",f);n.find("div[data-parent]").attr("data-parent",f);n.find("div[data-oldvalue]").removeAttr("data-oldvalue");n.find("span[data-valmsg-for]").attr("data-valmsg-for",f);DatePicker.bindDatePicker(n);i.before(n);o=t(".has-parent");u.removeData("validator");u.removeData("unobtrusiveValidation");t.validator.unobtrusive.parse("#"+u.attr("id"));n.find(".toggle-hide").show();n.find(".fa-plus").removeClass("fa-plus").addClass("fa-minus");t(".toggle-hide").not(n.find(".toggle-hide")).hide();t(".fa-minus").not(n.find(".fa-minus")).removeClass("fa-minus").addClass("fa-plus")});u.on("click",".btnDelete",function(){$this=t(this);t.magnificPopup.open({items:{src:"#dialog-confirm"},type:"inline",removalDelay:300,mainClass:"mfp-zoom-in",callbacks:{open:function(){var n=t(this.content);n.on("click",".btn-delete-section",function(){$this.closest(".additional").remove();t.magnificPopup.close()})}}})});u.on("click",".fa-minus",function(){$this=t(this);$this.next(".toggle-hide").hide();$this.removeClass("fa-minus").addClass("fa-plus");$this.parent().find(".btnDelete").addClass("minimise-delete")});u.on("click",".fa-plus",function(){$this=t(this);$this.next(".toggle-hide").show();$this.removeClass("fa-plus").addClass("fa-minus");$this.parent().find(".btnDelete").removeClass("minimise-delete")});u.on("mouseover",".image-selectable",function(){var n=t(this).offset(),i=t(this).width();t(this).hasClass("selected")==!1&&(t("body").append("<img class='image-preview' src='"+this.src+"' alt='Image preview' />"),t(".image-preview").css("top",n.top+"px").css("left",n.left+i+10+"px").fadeIn("fast"))});u.on("mouseout",".image-selectable",function(){t(".image-preview").fadeOut("fast")})}})(window.customsForm=window.customsForm||{},jQuery);_BillingAddressViewModel=function(n){var t=this;ko.mapping.fromJSON(n,{},t);Utilities.log(n);t.BillingAddressId=ko.observable("");t.ShowBillingAddressFields=ko.observable(!1);t.ShowPostcode=ko.observable(!1);t.BillingAddressId.subscribe(function(){t.BillingAddressId()==="0"?t.ShowBillingAddressFields(!0):t.ShowBillingAddressFields(!1)});t.CountryChange=function(){var n=$("#BillingAddress_CountryIso").find(":selected"),i=$(n).data("usespostcode");i=="True"?($("#BillingAddress_Postcode").val(""),t.ShowPostcode(!0)):($("#BillingAddress_Postcode").val("."),t.ShowPostcode(!1))}},function(n,t){function f(n){google.maps.event.addListener(n,"click",function(){var t='<div class="info-window">';t+="<h3>"+n.title+"<\/h3>";t+='<div class="ajax-loading-50" style="margin:10px auto;"><\/div>';t+="<\/div>";i.getZoom()<8&&i.setZoom(8);i.setCenter(n.getPosition());r.close();r.setContent(t);r.open(i,this);e(n.uniId)})}function e(n){t.ajax({url:"/student/_universityinfowindow",type:"POST",data:{id:n},success:function(n){n&&n.length>0&&r.setContent(n)},error:function(){var n='<div class="info-window">';n+="<h3>"+marker.title+"<\/h3>";n+="<\/div>";r.setContent(n)},complete:function(){}})}var i,u=[],r;n.initialiseMap=function(n){var c=new google.maps.LatLng(55.115165,-6.650812),l={zoom:4,center:c,mapTypeControl:!1,streetViewControl:!1},o,t;for(i=new google.maps.Map(document.getElementById("mapdiv"),l),r=new google.maps.InfoWindow,r.setOptions({maxWidth:500}),o=new google.maps.LatLngBounds,t=0;t<n.length;t++){var e=n[t],s=new google.maps.LatLng(e.latitude,e.longitude),h=new google.maps.Marker({position:s,map:i,title:e.name,uniId:e.id});o.extend(s);f(h);u.push(h)}i.fitBounds(o)}}(window.students=window.students||{},jQuery),function(n,t,i){function u(n){if(n!==i&&n!==null){var u="NONE",f="";return/^5[1-5]/.test(n)?u="MC":/^4/.test(n)?u="VISA":/^3[47]/.test(n)?(u="AMEX",t('.payment-card-type option[value="AMEX"]').length||(f="We don't currently accept AMEX, please use either Visa or MasterCard.")):/^(50|5[6-9]|6)/.test(n)?u="SWITCH":/^3(?:0[0-5]|[68][0-9])[0-9]/.test(n)?(u="DINERS",f="We don't currently accept diners cards, please use either Visa or MasterCard."):/^6(?:011|5[0-9]{2})[0-9]/.test(n)?(u="DISCOVER",f="We don't currently accept discover cards, please use either Visa or MasterCard."):/^(?:2131|1800|35\d{3})/.test(n)?(u="JCB",f="We don't currently accept jcb cards, please use either Visa or MasterCard."):/^(62|88)/.test(n)?(u="UNIONPAY",f="We don't currently accept union pay cards, please use either Visa or MasterCard."):n.length>5&&(u="UNKNOWN",f="We don't currently accept this card type, please use either Visa or MasterCard."),f.length?(r.text(f),r.css("display","block")):(r.text(""),r.css("display","none")),u}}var r=t("#payment-card-type-warning");n.initialise=function(){var f=t(".payment-card-number"),n=t(".payment-card-type"),i=t("#payment-card-type-container"),r=t("#payment-card-issue-container"),e=t(".payment-card-type-image");f.on("change keyup blur",function(){var f=u(t(this).val());e.not("#card-type-"+f).removeClass("active");f==="UNKNOWN"?(i.css("display","block"),n.val("")):(i.css("display","none"),f!=="NONE"?(n.val(f),t("#card-type-"+f).addClass("active")):n.val(""));f==="SWITCH"?r.css("display","block"):r.css("display","none")})}}(window.payments=window.payments||{},jQuery),function(n,t){var i,r="/Assets/Images/map/map-pin";n.initialise=function(r,u){var e,o,f,s;for(i=u,Utilities.log(r),e=t.parseJSON(r),o=new google.maps.LatLngBounds,f=0;f<e.length;f++)s=new google.maps.LatLng(e[f].Latitude,e[f].Longitude),n.addMarker(s,e[f].Id.toString()),o.extend(s);i.fitBounds(o)};n.addMarker=function(n,t){var u=new google.maps.Marker({position:n,map:i,icon:r+t+".png"})}}(window.smbMaps=window.smbMaps||{},jQuery),function(n,t,i){n.initialise=function(i,r){t("#share-on-facebook").on("click",function(i){i.preventDefault?i.preventDefault():i.returnValue=!1;var u=t(this).data("socialshareimage");FB.ui({method:"share",href:r,picture:u},function(t){Utilities.log(t);t&&!t.error_code&&n.applyBonus(1,null)})})};n.initialiseTwitter=function(){twttr.events.bind("tweet",function(t){Utilities.log(t);n.applyBonus(3,null)})};n.initialiseShareCounter=function(n,r){function u(n){return n>1e3&&(n=(n/1e3).toFixed(1),n=n>1e3?(n/1e3).toFixed(1)+"M":n+"k"),n}t(".count").each(function(n,i){service=t(i).parents(".share-btn").attr("data-service");switch(service){case"facebook":t(i).parents("a").attr("href","http://www.facebook.com/sharer/sharer.php?u="+r);t(".social-mobile-facebook").parents("a").attr("href","http://www.facebook.com/sharer/sharer.php?u="+r);break;case"twitter":t(i).parents("a").attr("href","https://twitter.com/intent/tweet?text="+r);t(".social-mobile-twitter").parents("a").attr("href","https://twitter.com/intent/tweet?text="+r);break;case"linkedin":t(i).parents("a").attr("href","http://www.linkedin.com/shareArticle?mini=true&url="+r);t(".social-mobile-linkedin").parents("a").attr("href","http://www.linkedin.com/shareArticle?mini=true&url="+r);break;case"google":t(i).parents("a").attr("href","https://plus.google.com/share?url="+r);t(".social-mobile-googleplus").parents("a").attr("href","https://plus.google.com/share?url="+r)}});t.ajax({url:"/widget/_socialwidgetcounts",data:{inputUrl:r},success:function(n){var f=JSON.parse(n),r;shares=f.shares;r=[];t(".count").each(function(n,f){service=t(f).parents(".share-btn").attr("data-service");shareCount=shares!=i?shares[service]:0;switch(service){case"facebook":shareCount>0&&(r.push(shareCount),shareCount=u(shareCount),t(f).css("display","block").html(shareCount),t(".social-mobile-facebook").html(shareCount));break;case"twitter":shareCount>0&&(r.push(shareCount),shareCount=u(shareCount),t(f).css("display","block").html(shareCount),t(".social-mobile-twitter").html(shareCount));break;case"linkedin":shareCount>0&&(r.push(shareCount),shareCount=u(shareCount),t(f).css("display","block").html(shareCount),t(".social-mobile-linkedin").html(shareCount));break;case"google":shareCount>0&&(r.push(shareCount),shareCount=u(shareCount),t(f).css("display","block").html(shareCount),t(".social-mobile-googleplus").html(shareCount))}r.length==0&&(t(".social-mobile-facebook").css("display","none"),t(".social-mobile-twitter").css("display","none"),t(".social-mobile-linkedin").css("display","none"),t(".social-mobile-googleplus").css("display","none"))})},error:function(){t(".social-mobile-facebook").css("display","none");t(".social-mobile-twitter").css("display","none");t(".social-mobile-linkedin").css("display","none");t(".social-mobile-googleplus").css("display","none")}});t(".btn-sharelink").on("click",function(n){n.preventDefault();window.open(this.href,"mywin","left=600,top=300,width=500,height=500,toolbar=1,resizable=0")})};n.initialiseReview=function(i,r,u){t("#share-on-facebook-review").on("click",function(t){t.preventDefault?t.preventDefault():t.returnValue=!1;FB.ui({method:"share",href:r},function(t){Utilities.log(t);t&&!t.error_code&&n.applyBonus(5,u)})})};n.initialiseReviewTwitter=function(t){twttr.events.bind("tweet",function(i){Utilities.log(i);n.applyBonus(5,t)})};n.applyBonus=function(n,i){var r={bonusType:n,customerId:i};t.ajax({url:"/account/_applybonus",type:"POST",data:r,success:function(){},error:function(){},complete:function(){}})}}(window.social=window.social||{},jQuery),function(n,t){function u(){f=!0;t("#help-widget").removeClass("help-widget-preload")}function o(n){i=n==="online";s();typeof faqs.updateChatStatus!="undefined"&&faqs.updateChatStatus(i)}function s(){r&&(i?(t("#help-widget").removeClass("hide-widget"),f?setTimeout(u,1):setTimeout(u,e*1e3)):(t("#help-widget").addClass("help-widget-preload"),setTimeout(function(){t("#help-widget").addClass("hide-widget")},1e3)))}var f=!1,r=!1,e=3,i=!1;n.initialiseZopim=function(n){r=n.toLowerCase()=="true";zE("webWidget","hide");zE("webWidget:on","chat:status",o);setTimeout(u,e*1e3)};n.startChat=function(){zE("webWidget","popout")};n.zopimOnline=function(){return i};t("#help-widget").click(function(t){r&&(t.preventDefault(),n.startChat())});t("#open-chat").click(function(t){t.preventDefault();i&&n.startChat()})}(window.thirdparty=window.thirdparty||{},jQuery),function(n,t){n.initialise=function(r,u,f,e,o,s){function a(n,i){t.ajax({url:"/widget/_faqquestion",type:"get",data:{questionRef:n},success:function(n){i=="contactus"?(t("#popup-dynamic-container").html(n),openPopup("#popup-dynamic-container")):(h.addClass("active"),h.html(n))},error:function(){h.addClass("active");h.html("Sorry it looks like there was an error loading this data, please try again or contact us.")},complete:function(){h.removeClass("is-loading")}})}function y(n){n===null||n.questionRef===null?(h.removeClass("active"),h.html("")):a(n.questionRef)}function p(n){var t=document.createElement("DIV");return t.innerHTML=n,t.textContent||t.innerText}var v=algoliasearch(r,u),l=v.initIndex(f),h=t("#faq-body"),c;try{history.replaceState({questionRef:o,smb:!0},"")}catch(w){}t(".faq-search-input").not(".no-autocomplete").autocomplete({hint:!1},[{source:t.fn.autocomplete.sources.hits(l,{hitsPerPage:15,tagFilters:e}),displayKey:"question",templates:{suggestion:function(n){return n._highlightResult.question.value}}}]).on("autocomplete:selected",function(n,t){if(h.addClass("is-loading"),s=="faq")try{history.pushState({questionRef:t.questionRef,smb:!0},"Question "+t.questionRef,"/support/faqs/question/"+t.questionRef)}catch(i){}a(t.questionRef,s)});t(".faq-search-input.no-autocomplete").keyup(function(n){n.keyCode===13&&t("#btnSearchFaq").click()});t("#btnSearchFaq").click(function(){t("#btnDisplayMore").hide();var n=t(".faq-search-input.no-autocomplete").val(),r=Handlebars.compile(t("#faq-template").html());t("#faq-results").html("");l.search({query:n,tagFilters:e},function(u,f){var e,o;if(!u&&f.hits.length>0){for(e=f.hits,i=0;i<e.length;i++)o=r({Title:e[i].question,Body:p(e[i].answer).substring(0,220),QuestionId:e[i].questionRef,Hidden:i>=4?"none":""}),t("#faq-results").append(o);e.length>4&&t("#btnDisplayMore").show();history.pushState({question:n,smb:!0},"","/support/needhelp?question="+n);t("#faq-results").show();t("#faq-no-results").hide()}else t("#faq-results").hide(),t("#faq-no-results").show();t(".help-section-container").show()})});t(".faq-search-input.no-autocomplete").length&&(c=t(".faq-search-input.no-autocomplete"),c.val()&&c.val().length>0&&t("#btnSearchFaq").click());t("#btnDisplayMore").click(function(){t("#faq-results").find("div").css("display","");t(this).hide()});n.updateChatStatus=function(n){n?(t("#open-chat").removeClass("chat-offline").addClass("chat-online"),t("#offline-chat").addClass("chat-online")):(t("#open-chat").addClass("chat-offline").removeClass("chat-online"),t("#offline-chat").removeClass("chat-online"))};t(window).on("popstate",function(n){n.originalEvent.state.smb&&y(n.originalEvent.state)})}}(window.faqs=window.faqs||{},jQuery),function(n,t,r){function f(n){if(!e()){o(n);var i={questionId:t("#Id").val(),wasHelpful:n};t.ajax({url:"/widget/_faqfeedback",data:i,type:"POST",success:function(i){t("#feedbackComplete").show();i&&s(n)},error:function(){t("#FaqHelpful").addClass(".faq-was-helpful");t("#FaqNotHelpful").addClass(".faq-not-helpful")}})}}function u(){t("#FaqHelpful").removeClass(".faq-was-helpful");t("#FaqNotHelpful").removeClass(".faq-not-helpful")}function e(){var n,e=t("#Id").val(),f=document.cookie.split("; "),s;for(i=0;i<f.length;i++)f[i].startsWith("smbFaqFeedback-"+e+"=")&&(s=f[i].split("=")[1],n=JSON.parse(s));return n&&n.questionId==e?(u(),o(n.wasHelpful),n):r}function s(n){var i=t("#Id").val(),r={questionId:i,wasHelpful:n},u=moment(new Date).add(1,"y").format("ddd, DD MMM YYYY HH:mm:ss UTC");document.cookie="smbFaqFeedback-"+i+"="+JSON.stringify(r)+"; expires="+u+"; path=/"}function o(n){n?t("#FaqHelpful").addClass("secondary"):t("#FaqNotHelpful").addClass("secondary")}n.initialise=function(){e()};t(".faq-was-helpful").click(function(){u();f(!0)});t(".faq-not-helpful").click(function(){u();f(!1)})}(window.faqFeedback=window.faqFeedback||{},jQuery);_RebookMissedCollectionModel=function(n){var t=this;ko.mapping.fromJSON(n,{},t);t.IsReasonSelected=ko.observable(!1);t.DisplayTextArea=ko.observable(!1);t.CourierNotArrivedLabel=ko.observable();t.CourierAdditionalInfoLabel=ko.observable();t.setReasonMissedCollection=ko.observable();t.SubmitText=ko.observable("Confirm");t.SubmitDisabled=ko.observable(!1);t.updateAddressHref=function(){var t=$("#updateAddress"),i=$("#Address_Id").val(),r=$("#ReasonForMissedCollection").val(),n=t.data("href");n=n.substring(0,n.indexOf("reason=")+7)+r;n=n.replace(/(addressId=)(\d+)/,"$1"+i);t.data("href",n)};t.setReasonMissedCollection.subscribe(function(n){n?(t.IsReasonSelected(!0),t.updateAddressHref(),n==="Other"||n==="Courier Didn't Arrive"?(n==="Courier Didn't Arrive"?(t.CourierAdditionalInfoLabel(!1),t.CourierNotArrivedLabel(!0)):(t.CourierNotArrivedLabel(!1),t.CourierAdditionalInfoLabel(!0)),t.DisplayTextArea(!0)):t.DisplayTextArea(!1)):(t.IsReasonSelected(!1),t.DisplayTextArea(!1))},this);t.setReasonMissedCollection("@Model.ReasonForMissedCollection")}