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, Province of China",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")}})});$("#currency-select").on("click",function(n){n.preventDefault?n.preventDefault():n.returnValue=!1;n.stopPropagation();$("#currency-list-container").css("display","block")});$(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){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(var u in n)optionList+="<option value='"+n[u][t]+"'>"+n[u][i]+"<\/option>";$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}},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(){var n=$(".origin-country-select").find(".country-select"),t=n.closest(".route-country-group").find(".destination-country-select").find("select.country-select"),i=t.find("optgroup option");i.length||t.select2("enable",!1);n.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}},DatePicker;$(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 f(n){var t="day-"+n.getDate(),i=$.datepicker.noWeekends(n),r;return i[0]&&datePickerBlockedDays?(r=jQuery.datepicker.formatDate("yy-mm-dd",n),[$.inArray(r,datePickerBlockedDays)==-1,t,""]):[i[0],t,""]}function e(n){var t="day-"+n.getDate(),i=$.datepicker.noWeekends(n),r;return i[0]&&datePickerBlockedDaysReturn?(r=jQuery.datepicker.formatDate("yy-mm-dd",n),[$.inArray(r,datePickerBlockedDaysReturn)==-1,t,""]):[i[0],t,""]}function o(n){var t="day-"+n.getDate();return[!0,t,""]}var u=new Date,r=u.getUTCDay(),t=1,i=2;Utilities.isMobileOrTablet()&&(i=1);r==6?t=2:r==5&&(t=3);$(n).find(".datepicker").each(function(){var s=$(this).data("function"),o=f,n,r,u;switch(s){case"noWeekendsOrHolidaysReturn":o=e}n=$(this).data("altfield")||"";r=null;n.length>0&&(r=function(){$(n).change()});u=$(this).data("selecteddate")||"";u.length>0&&(t=u);$(this).datepicker({dateFormat:"dd/mm/yy",beforeShowDay:o,onClose:function(){$(this).attr("disabled",!1)},beforeShow:function(){$(this).attr("disabled",!0)},minDate:1,maxDate:"+1y",numberOfMonths:i,defaultDate:t,altField:n,onSelect:r})});$(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:i,defaultDate:t});$(n).find(".datepicker-any").datepicker({dateFormat:"dd/mm/yy",onClose:function(){$(this).attr("disabled",!1)},beforeShow:function(){$(this).attr("disabled",!0)},beforeShowDay:o,numberOfMonths:i,defaultDate:t})}};$(document).ready(function(){var r,t,i,n;$("#btn-show-main-menu").on("click",showMainNav);$("#btn-close-main-menu").on("click",hideMainNav);$("body").on("mouseenter",".tooltip",openTooltip);Localise.initCurrencySelect();$(".accordion-tab").on("click",accordionClick);if(accordionInitialise(),r=function(){var i=$("#splash-inner-container"),n;i.length&&(n=$("<div>").attr("class","splash-image splash-image-02"),i.append(n),n=$("<div>").attr("class","splash-image splash-image-03"),i.append(n),n=$("<div>").attr("class","splash-image splash-image-04"),i.append(n),n=$("<div>").attr("class","splash-image splash-image-05"),i.append(n),t())},t=function(){var i=$(".splash-image-active"),n=i.next();n=n.length?n:i.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");i.removeClass("splash-image-active");TweenLite.set(i,{opacity:0});t()}})},r(),i=$("#order-summary-position"),n=$("#order-summary-container"),i.length&&n.length){function u(){var t=i.offset(),r=t.top-$(window).scrollTop(),u=$(window).height(),f=n.outerHeight();r<=20&&u-f>20?n.addClass("order-summary-fixed"):n.removeClass("order-summary-fixed")}$(window).scroll(u);u()}});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");t.hasClass("accordion-closed")?TweenLite.to(i,.3,{height:i.find(".faq-answer").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")})};$(document).ready(function(){Utilities.isMobileOrTablet()||$(".select2").select2({width:"resolve",matcher:function(t,i,r){return n(t,i,r)}});$(".phonenumber-countrycode").select2({width:"off",dropdownAutoWidth:!0,dropdownCssClass:"countrycode-dropdown",formatResult:Countries.FormatCountryCodeResult,formatSelection:Countries.FormatCountryCodeSelection,escapeMarkup:function(n){return n},matcher:function(t,i,r){return n(t,i,r)}});DatePicker.initDatePickers();Countries.InitRouteCountryDropdowns();var n=function(n,t,i){var r=i.data("alt")||"";return t.toUpperCase().indexOf(n.toUpperCase())>=0||r.toUpperCase().indexOf(n.toUpperCase())>=0};$(".open-popup").magnificPopup({type:"inline",midClick:!0,removalDelay:300,mainClass:"mfp-zoom-in"})});$(function(){$htmlbody=$("html,body");$("a[href*=#]:not([href=#])").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 showModalWindow=function(n){$("#modal-header").html(dialog_content_array[n].Title);$("#modal-content").html(dialog_content_array[n].Description);openPopup("#dialog-info")},openPopup=function(n){$.magnificPopup.open({items:{src:n},type:"inline",removalDelay:300,mainClass:"mfp-zoom-in"})},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 u=$("#destination-countryIso").val(),f=$("#Origin_CountryIso").val(),t=$("#destination-customs"),i=$("#restricted-items-express"),r=$("#restricted-items-standard"),n=50,e={originCountryIso:f,destinationCountryIso:u};$.ajax({url:"/Country/_Customs",type:"POST",data:e,success:function(u){u.hasCustoms==="true"?t.show(n):t.hide(n);u.hasStandardRoute==="true"?(i.hide(n),r.show(n)):(i.show(n),r.hide(n))},error:function(){t.show(n);i.show(n);r.hide(n)},complete:function(){}})}},_DeliveryMethodViewModel=function(n){var t=this;ko.mapping.fromJS(n,{},t)},_QuoteViewModel=function(n){var t=this;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.Tier1MaxWeight=ko.observable(0);t.Tier2MaxWeight=ko.observable(0);t.MaxWeight=ko.observable(0);t._HasRasCharge=ko.observable(!1);t._DeliveryMethods=ko.observableArray();t.CourierTransitTime=ko.observable(0);t.DiscountAmount=ko.observable(0);t.DiscountDescription=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.IsFormReady=ko.computed(function(){return 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.TotalBags=ko.computed(function(){return parseInt(t.Tier1Bags())+parseInt(t.Tier2Bags())});t.CountryChange=function(n,t){var i=$("#"+t+"_CountryIso").find(":selected");n.CountryUsesPostcode(i.data("usespostcode")==="False"?!1:!0);n.CountryPostcodeFormat(i.data("postcodeformat"))};t.Origin.CountryIso.subscribe(function(){t.CountryChange(t.Origin,"Origin")});t.Destination.CountryIso.subscribe(function(){t.CountryChange(t.Destination,"Destination")});t.updateQuote=function(){if(t.IsFormReady()){t.GettingQuote(!0);var n=ko.mapping.toJSON(t,{ignore:["CollectionDate","CollectionDateReturn"]});Utilities.log("getting quote...",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);$.ajax({url:"/Quote/GetQuickQuote",type:"POST",contentType:"application/json",data:n,success:function(n){if(Utilities.log("...complete (getting quote)",Utilities.LOGLEVEL.INFO),Utilities.log(n,Utilities.LOGLEVEL.INFO),Utilities.log("-",Utilities.LOGLEVEL.INFO),t.IsRouteAvailable(!0),n&&n.IsBlockingError)switch(n.ErrorType){case 4:case 5:case 6:t.IsRouteAvailable(!1);$("#modal-content").html(n.ErrorMessage||"There appears to be a problem with the route you have specified.");openPopup("#dialog-error")}n.Journeys[0].IsDeliveryDateSetByCourier&&n.Journeys[0].TransitTime>0?t.CourierTransitTime(n.Journeys[0].TransitTime):t.CourierTransitTime(0);t.TotalCost(n.Total);t._HasRasCharge(n.Journeys[0].RasCharge!==null);t.DiscountAmount(n.DiscountAmount);t.DiscountDescription(n.DiscountDescription)},error:function(){t.TotalCost(0);t._HasRasCharge(!1)},complete:function(){t.PostcodeChange(t.Origin,"Origin");t.PostcodeChange(t.Destination,"Destination");t.GettingQuote(!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();return}$("#"+t+"_Postcode").removeClass("custom-input-validation-error");$('.custom-validation-message[data-for="'+t+'_Postcode"]').hide()};t._TriggerQuoteUpdate.subscribe(function(n){n===!0&&(t._TriggerQuoteUpdate(!1),t.updateQuote())});ko.computed(function(){t.Origin.CountryIso();t.Destination.CountryIso();t.JourneyType();t.DeliveryMethodType();t.Tier1Bags();t.Tier2Bags();t.GolfBags();t.SkiBags();t.OversizeBags();t.TotalBags();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(){if(t.IsFormReady()){t.GettingQuoteDeliveryMethods(!0);t.GettingRouteAlerts(!0);var n={originCountryIso:t.Origin.CountryIso(),destinationCountryIso:t.Destination.CountryIso(),isReturn:t.IsReturn()};Utilities.log("getting delivery methods...",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);$.ajax({url:"/Quote/GetQuoteDeliveryMethods",type:"POST",data:n,success:function(n){var r,i;if(Utilities.log("...complete (getting delivery methods)",Utilities.LOGLEVEL.INFO),Utilities.log(n,Utilities.LOGLEVEL.INFO),Utilities.log("-",Utilities.LOGLEVEL.INFO),t._DeliveryMethods.removeAll(),n.length>0){for(t.Tier1MaxWeight(n[0].Tier1MaxWeight_Final),t.Tier2MaxWeight(n[0].Tier2MaxWeight_Final),t.MaxWeight(n[0].CourierMaxWeight),t.MaxWeight<=t.Tier2MaxWeight&&t.OversizeBags(0),r=!1,i=0;i<n.length;i++)t._DeliveryMethods.push(new _DeliveryMethodViewModel(n[i])),n[i].DeliveryMethodType===t.DeliveryMethodType()&&(r=!0);r||t.DeliveryMethodType(n[0].DeliveryMethodType)}else t.Tier1MaxWeight(0),t.Tier2MaxWeight(0),t.MaxWeight(0)},error:function(){t.Tier1MaxWeight(0);t.Tier2MaxWeight(0);t.MaxWeight(0)},complete:function(){t.GettingQuoteDeliveryMethods(!1)}});$.ajax({url:"/Country/_RouteAlerts",type:"POST",data:n,success:function(n){$("#route-alerts").html(n).css("display","block")},error:function(){},complete:function(){t.GettingRouteAlerts(!1)}})}},this).extend({rateLimit:10});t.getEstimatedDates=function(n,i){Utilities.log("getting estimated date ["+i+"]...",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);$.ajax({url:"/Quote/GetEstimatedDate",type:"POST",contentType:"application/json",data:n,success:function(n){Utilities.log("...complete (getting estimated date ["+i+"])",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);Utilities.log("-",Utilities.LOGLEVEL.INFO);n.errorType===1&&(i===1?t.DeliveryDate(n.EstimatedDeliveryDate):t.DeliveryDateReturn(n.EstimatedDeliveryDate))},complete:function(){i===1?t.GettingDeliveryDate(!1):t.GettingDeliveryDateReturn(!1)}})};t.changeDeliveryMethod=function(){t.CourierTransitTime(0);t.DeliveryMethodType()===1?t.DeliveryMethodType(2):t.DeliveryMethodType(1)};t.setDeliveryMethod=function(n){t.CourierTransitTime(0);t.DeliveryMethodType(n.DeliveryMethodType())};t.changeJourneyType=function(){t.JourneyType()==="Return"?t.JourneyType("OneWay"):t.JourneyType("Return")}};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.")},_Step1ViewModel=function(n){var t=this,i=$("#dialog-select-address");ko.mapping.fromJSON(n,{},t);Utilities.log(n);t.Origin._LoadingRegions=ko.observable(!1);t.Destination._LoadingRegions=ko.observable(!1);t.Origin._LoadingCities=ko.observable(!1);t.Destination._LoadingCities=ko.observable(!1);t.Origin.CitySelect=ko.observable(t.Origin.City());t.Destination.CitySelect=ko.observable(t.Destination.City());t.Origin.CitySelectVisible=ko.observable(!1);t.Destination.CitySelectVisible=ko.observable(!1);t.Origin.CitySelectEnabled=ko.observable(!0);t.Destination.CitySelectEnabled=ko.observable(!0);t.Origin.ProvinceName=ko.observable("");t.Destination.ProvinceName=ko.observable("");t._AddressSearch=ko.observable(t.Origin);t._AddressSearchResults=ko.observableArray().extend({rateLimit:50});t.GettingRouteAlerts=ko.observable(!1);t.CapabilityCheckFailed=ko.observable(!1);t.GettingCapability=ko.observable(!1);t._TriggerCapabilityCheck=ko.observable(!1);t.CanCheckCapability=ko.computed(function(){return!t.Origin.CountryIso()||!t.Origin.CountryIso().length||!t.Destination.CountryIso()||!t.Destination.CountryIso().length?!1:t.Origin.CountryUsesPostcode()&&(!t.Origin.Postcode()||!t.Origin.Postcode().length)?!1:t.Destination.CountryUsesPostcode()&&(!t.Destination.Postcode()||!t.Destination.Postcode().length)?!1:!t.Origin.City()||!t.Origin.City().length||!t.Destination.City()||!t.Destination.City().length?!1:!0});t.IsNextEnabled=ko.computed(function(){return t.CapabilityCheckFailed()||t.GettingCapability()?!1:t.CanCheckCapability()?!0:!1});t.Origin.UsePostcodeLookup=ko.computed(function(){return t.Origin.CountryIso()&&(t.Origin.CountryIso().slice(0,2)==="GB"||t.Origin.CountryIso()==="IE")});t.Destination.UsePostcodeLookup=ko.computed(function(){return t.Destination.CountryIso()&&(t.Destination.CountryIso().slice(0,2)==="GB"||t.Destination.CountryIso()==="IE")});t.Origin.CitySelect.subscribe(function(){t.Origin.CitySelectVisible()&&t.Origin.City(t.Origin.CitySelect())});t.Destination.CitySelect.subscribe(function(){t.Destination.CitySelectVisible()&&t.Destination.City(t.Destination.CitySelect())});t.JourneyType.subscribe(function(){t.reloadOrderSummary()});t.Origin.CountryIso.subscribe(function(){t.CountryChange(t.Origin,"Origin")});t.Destination.CountryIso.subscribe(function(){t.CountryChange(t.Destination,"Destination")});t.Origin.CountryUsesPostcode.subscribe(function(){t.Origin.CountryUsesPostcode()||t.Origin.Postcode("-")});t.Destination.CountryUsesPostcode.subscribe(function(){t.Destination.CountryUsesPostcode()||t.Destination.Postcode("-")});t.Origin.Postcode.subscribe(function(){t.PostcodeChange(t.Origin,"Origin")});t.Destination.Postcode.subscribe(function(){t.PostcodeChange(t.Destination,"Destination")});t.Origin.ProvinceName.subscribe(function(){t.ProvinceNameChange(t.Origin,"Origin")});t.Destination.ProvinceName.subscribe(function(){t.ProvinceNameChange(t.Destination,"Destination")});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.PostcodeChange=function(n,i){if(t.reloadOrderSummary(),n.CountryUsesPostcode()&&n.Postcode()&&n.Postcode().length>0&&!Utilities.validatePostcodeFormat(n.Postcode(),n.CountryPostcodeFormat())){$("#"+i+"_Postcode").addClass("custom-input-validation-error");$('.custom-validation-message[data-for="'+i+'_Postcode"]').show();return}$("#"+i+"_Postcode").removeClass("custom-input-validation-error");$('.custom-validation-message[data-for="'+i+'_Postcode"]').hide();t.updateCities(n,i)};t.CountryChange=function(n,i){var f,u,r;n.ContactPhone.CountryCode()&&n.ContactPhone.Number()||(f=$("#"+i+"_ContactPhone_CountryCode"),f.select2("val",n.CountryIso().slice(0,2)));u=$("#"+i+"_RegionId");r=$("#"+i+"_CountryIso").find(":selected");n.Line1("");n.Line2("");n.Line3("");n.Postcode(null);n.City("");n.CitySelect("");n.RegionId(null);u.select2("val",null);u.html("");n.CountryUsesPostcode(r.data("usespostcode")==="False"?!1:!0);n.CountryUsesRegions(r.data("usesregions")==="False"?!1:!0);n.CountryUsesCompanyName(r.data("usescompanyname")==="False"?!1:!0);n.CountryPostcodeFormat(r.data("postcodeformat"));t.updateRegions(n,i);t.updateCities(n,i);t.reloadOrderSummary()};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")};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.updateCities=function(n,t){var i=$("#"+t+"_City_select"),r,u;if(i.empty().append('<option selected="selected" value=""><\/option>'),n.UsePostcodeLookup()){n.CitySelectVisible(!1);n.CitySelectEnabled(!0);return}if((!n.Postcode()||!n.Postcode().length)&&n.CountryUsesPostcode()){n.CitySelectVisible(!1);n.CitySelectEnabled(!1);return}n._LoadingCities(!0);n.CitySelectVisible(!1);n.CitySelectEnabled(!1);r=n.City();n.City("");u={countryIso:n.CountryIso(),postcode:n.Postcode()};Utilities.log("getting cities...",Utilities.LOGLEVEL.INFO);Utilities.log(u,Utilities.LOGLEVEL.INFO);$.ajax({url:"/Country/GetCities",type:"POST",data:u,success:function(t){var f,u;Utilities.log("...getting cities success",Utilities.LOGLEVEL.INFO);f={target:i};Utilities.populateSelect.call({customParams:f},t,"Text","Text",{value:"",text:""});u=t.length||0;n.CitySelectVisible(u>1);n.CitySelectEnabled(u!==1);u===1?n.City(t[0].Text):u===0?(n.CitySelect(""),i.select2("val","")):i.find("option[value='"+r+"']").length>0?(n.CitySelect(r),i.select2("val",r)):(n.City(""),n.CitySelect(""),i.select2("val",""))},error:function(){Utilities.log("...getting cities failed",Utilities.LOGLEVEL.INFO);n.CitySelectVisible(!1);n.CitySelectEnabled(!0)},complete:function(){n._LoadingCities(!1)}})};t.reloadOrderSummary=function(){if(t.Origin.CountryIso().length&&t.Destination.CountryIso().length){$("#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/_OrderSummaryStep1",type:"POST",contentType:"application/json",data:n,success:orderSummaryLoaded,error:orderSummaryLoadError,complete:function(){$("#order-summary-container").removeClass("is-loading")}})}};t.CapturePlus_Find=function(n,r,u){i.addClass("is-loading");$.getJSON("https://services.postcodeanywhere.co.uk/CapturePlus/Interactive/Find/v2.00/json3.ws?callback=?",{Key:t.PostcodeAnywhereKey(),SearchTerm:n,LastId:r,SearchFor:"PostalCodes",Country:u,LanguagePreference:"EN"},t.CapturePlus_Find_Success)};t.CapturePlus_Find_Success=function(n){if(i.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(t._AddressSearchResults.removeAll(),n.Items.length===1)t.selectAddress(n.Items[0]);else for(var r=0;r<n.Items.length;r++)t._AddressSearchResults.push(n.Items[r])};t.CapturePlus_Retrieve=function(n){$.getJSON("https://services.postcodeanywhere.co.uk/CapturePlus/Interactive/Retrieve/v2.00/json3.ws?callback=?",{Key:t.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{t._AddressSearch().Postcode(n.Items[0].PostalCode);var r=n.Items[0].Line1,i="";n.Items[0].Line5&&n.Items[0].Line5.length?(r+=", "+n.Items[0].Line2,i=n.Items[0].Line3+", "+n.Items[0].Line4+", "+n.Items[0].Line5):n.Items[0].Line4&&n.Items[0].Line4.length?(r+=", "+n.Items[0].Line2,i=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?(r+=", "+n.Items[0].Line2,i=n.Items[0].Line3):i=n.Items[0].Line2+", "+n.Items[0].Line3:i=n.Items[0].Line2;t._AddressSearch().Line1(r);t._AddressSearch().Line2(i);t._AddressSearch().City(n.Items[0].City);t._AddressSearch().CompanyName(n.Items[0].Company);t._AddressSearch().ProvinceName(n.Items[0].ProvinceName)}})};t.findAddress=function(n){t._AddressSearchResults.removeAll();t._AddressSearch(n);openPopup("#dialog-select-address");t.CapturePlus_Find(n.Postcode(),null,n.CountryIso().slice(0,2))};t.selectAddress=function(n){n.Next==="Retrieve"?(t.CapturePlus_Retrieve(n.Id),$.magnificPopup.close({items:{src:"#dialog-select-address"}})):n.Next==="Find"&&t.CapturePlus_Find("",n.Id,"")};t.CapabilityCheck=function(){if(t.CanCheckCapability()){t.GettingCapability(!0);t.CapabilityCheckFailed(!1);var n=ko.mapping.toJSON(t,{ignore:[]});Utilities.log("Getting Capability...",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);$.ajax({url:"/Quote/GetAddressCapabilityCheck",type:"POST",contentType:"application/json",data:n,success:function(n){if(Utilities.log("...Getting Capability complete",Utilities.LOGLEVEL.INFO),Utilities.log(n,Utilities.LOGLEVEL.INFO),Utilities.log("-",Utilities.LOGLEVEL.INFO),n&&n.IsBlockingError)switch(n.ErrorType){case 4:case 5:case 6:$("#modal-content").html(n.ErrorMessage||"There appears to be a problem with the route you have specified.");openPopup("#dialog-error");t.CapabilityCheckFailed(!0)}},complete:function(){t.GettingCapability(!1)}})}};t._TriggerCapabilityCheck.subscribe(function(n){n===!0&&(t._TriggerCapabilityCheck(!1),t.CapabilityCheck())});ko.computed(function(){t.Origin.CountryIso();t.Destination.CountryIso();t.Origin.Postcode();t.Destination.Postcode();t.Origin.City();t.Destination.City();t.Origin.CitySelect();t.Destination.CitySelect();t._TriggerCapabilityCheck(!0)},this).extend({rateLimit:100,method:"notifyWhenChangesStop"});t.Origin.CitySelect(t.Origin.City());t.Destination.CitySelect(t.Destination.City());t.PostcodeChange(t.Origin,"Origin");t.PostcodeChange(t.Destination,"Destination")},_Step2ViewModel=function(n){var t=this;ko.mapping.fromJSON(n,{},t);t.NewBag.BagTypeDescription=ko.observable("");t.AddingBag=ko.observable(!1);t.GettingRouteAlerts=ko.observable(!1);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.addBag=function(){var i=$("#bag-form"),r,n;return i&&i.valid()&&t.validateVolumetricWeight()&&(t.AddingBag(!0),t.NewBag.CustomsInvoiceRequired()||t.NewBag.Value(0),r={},n=ko.mapping.toJSON(t.NewBag,r),Utilities.log("adding bag...",Utilities.LOGLEVEL.INFO),Utilities.log(n,Utilities.LOGLEVEL.INFO),$.ajax({url:"/Order/_AddBag",type:"POST",contentType:"application/json",data:n,success:function(n){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),t.Bags.push(cloneObservable(t.NewBag)),t.clearBagValues(t.NewBag),t.reloadOrderSummary())},error:function(){},complete:function(){t.AddingBag(!1)}})),!1};t.validateVolumetricWeight=function(){return t.NewBag.VolumetricWeight()>t.NewBag.MaxWeight()?(showModalWindow("VOLUMETRIC_WEIGHT_TOO_BIG"),!1):!0};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.clearBagValues=function(n){n.Width(null);n.Height(null);n.Length(null);n.EnteredWeight(null);n.Value(null);n.Name(null);n.BagTypeId("")};t.NewBag.Value.subscribe(function(){t.NewBag.Value()>t.CustomsValueWarningThreshold()&&showModalWindow("CUSTOMS_VALUE")});t.NewBag.BagTypeId.subscribe(function(){t.NewBag.BagTypeDescription($("#BagTypeId").find(":selected").data("description"))});t.clearBagValues(t.NewBag);t.LossCoverProductId.subscribe(function(){t.reloadOrderSummary()});t.reloadOrderSummary=function(){$("#order-summary-container").addClass("is-loading");var n={lossCoverProductId:t.LossCoverProductId()};Utilities.log("update Order Summary...",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);$.ajax({url:"/Order/_OrderSummaryStep2",type:"POST",data:n,success:orderSummaryLoaded,error:orderSummaryLoadError,complete:function(){$("#order-summary-container").removeClass("is-loading")}})}},_Step3ViewModel=function(n){var t=this,i;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.IsNextEnabled=ko.computed(function(){return t.IsDateAvailable()&&t.IsReturnDateAvailable()});i="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+i,"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+i,"DD/MM/YYYY HH:mm").toDate())}});t.getEstimatedDates=function(n,i){Utilities.log("getting estimated date...",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);$.ajax({url:"/Quote/GetEstimatedDate",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.IsReturnDateAvailable(!0),t.DeliveryDateReturn(moment.utc(n.EstimatedDeliveryDate))),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),openPopup("#dialog-info")))}},complete:function(){i===1?t.GettingDeliveryDate(!1):t.GettingDeliveryDateReturn(!1)}})};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(){t.getEstimatedDate()});t.CollectionDateReturn.subscribe(function(){t.getEstimatedReturnDate()});t.DeliveryMethodType.subscribe(function(){t.getEstimatedDate();t.getEstimatedReturnDate();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/_OrderSummaryStep3",type:"POST",contentType:"application/json",data:n,success:orderSummaryLoaded,error:orderSummaryLoadError,complete:function(){$("#order-summary-container").removeClass("is-loading")}})}},_Step4ViewModel=function(n){var t=this;ko.mapping.fromJSON(n,{},t);Utilities.log(n);t.YourName=ko.observable("");t.IsRegistered=ko.observable("false");t.DeliveryAddress._LoadingRegions=ko.observable(!1);t.DeliveryAddress.ProvinceName=ko.observable("");t.GettingRouteAlerts=ko.observable(!1);t.Purpose1SubType=ko.observable(0);t.Purpose1Description=ko.observable("");t.DeliveryAddress._LoadingCities=ko.observable(!1);t.DeliveryAddress.CitySelect=ko.observable(t.DeliveryAddress.City());t.DeliveryAddress.CitySelectVisible=ko.observable(!1);t.DeliveryAddress.CitySelectEnabled=ko.observable(!0);t.IsNextEnabled=ko.computed(function(){return!0});t.DeliveryAddress.UsePostcodeLookup=ko.computed(function(){return t.DeliveryAddress.CountryIso()&&(t.DeliveryAddress.CountryIso().slice(0,2)==="GB"||t.DeliveryAddress.CountryIso()==="IE")});t.IsRegistered.subscribe(function(){t.IsRegistered()==="true"?t.YourName("------"):t.YourName("")});ko.computed(function(){t.PostLabels()||t.PostLabelHolders()||t.PostageMethodId(null)});t.Purpose1Id.subscribe(function(){var n=$("#Purpose1Id").find(":selected");t.Purpose1SubType(n.data("subtype"));t.Purpose1Description(n.data("description"))});t.PostageMethodId.subscribe(function(){var n=$("input[name=PostageMethodId]:checked"),i;t.PostageMethodId()&&n&&(i=n.data("showwarning"),i&&openPopup("#dialog-postage-cutoff"))});ko.computed(function(){$("#order-summary-container").addClass("is-loading");var n=ko.mapping.toJSON(t,{ignore:["UseCollectionAddressForDelivery","DeliveryAddress","Purpose1Id","Purpose1SubType","Purpose1Description","UniversityId"]});Utilities.log("update Order Summary...",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);$.ajax({url:"/Order/_OrderSummaryStep4",type:"POST",contentType:"application/json",data:n,success:orderSummaryLoaded,error:orderSummaryLoadError,complete:function(){$("#order-summary-container").removeClass("is-loading")}})})},_PackingListViewModel=function(n){var t=this;ko.mapping.fromJSON(n,{},t);t.IsSaving=ko.observable(!1);t.CurrencySymbol=ko.computed(function(){return t.CurrencyCode(),$("#CurrencyCode").find(":selected").data("symbol")});t.addItem=function(){t.InvoiceItems.push({no_of_units:ko.observable(1),unit_of_measure:ko.observable("Piece"),description_of_goods:ko.observable(""),country_of_origin:ko.observable(t.CountryIso().slice(0,2)),unit_value:ko.observable(0)})};t.removeItem=function(n){t.InvoiceItems.remove(n)};t.save=function(){t.IsSaving(!0);var n=ko.mapping.toJSON(t);Utilities.log("saving...",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);$.ajax({url:"/Account/CreatePackingList",type:"POST",contentType:"application/json",data:n,success:function(n){Utilities.log("...complete (saving)",Utilities.LOGLEVEL.INFO);Utilities.log(n,Utilities.LOGLEVEL.INFO);Utilities.log("-",Utilities.LOGLEVEL.INFO);n.filename?($("#create-packing-list-container").css("display","none"),$("#show-packing-list-container").css("display","block"),$("#packing-list-download-container").append('<a href="'+n.filename+'" target="_blank" class="btn-standard">Download now<i class="icon-download-alt" style="margin-left:2em;"><\/i><\/a>')):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)}})}};(function(n,t){function r(n,i,r,e){var s,o;f(n,i);i.data("isallowed")==="no"?(i.val(null),i.removeAttr("checked")):(s=u.filter('[data-parent="'+n+'"]'),s.css("display","block"));o=r.data("selectedmessage");e&&o&&o.length&&(t("#modal-content").html(o),openPopup("#dialog-info"))}function f(n,t){var r=t.closest(".field-item"),f,i;r&&(f=r.data("oldanswer"),r.data("oldanswer",n),f&&(i=u.filter('[data-parent="'+f+'"]'),i.css("display","none"),i.find("input, textarea, select").val(null),i.find("input:checked").removeAttr("checked")))}var i=t("#customs-form"),u=t(".has-parent");n.initialise=function(){i.on("change","input",function(){var n=t(this).data("answer");n&&r(n,t(this),t(this),!0)});i.on("change","select",function(){r(t(this).find(":selected").data("answer"),t(this),t(this).find(":selected"),!0)});i.find("input:radio:checked").each(function(){var n=t(this).data("answer");n&&r(n,t(this),t(this),!1)});i.find("select option:selected").each(function(){r(t(this).data("answer"),t(this).closest("select"),t(this),!1)})}})(window.customsForm=window.customsForm||{},jQuery),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)