$(function(){function p(){return[{featureType:"water",elementType:"geometry",stylers:[{color:"#a6a6a0"},{lightness:17}]},{featureType:"landscape",elementType:"geometry",stylers:[{color:"#f5f5f5"},{lightness:20}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#ffffff"},{lightness:17}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#cccccc"},{lightness:.2},{weight:.5}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{color:"#ffffff"},{lightness:18}]},{featureType:"road.arterial",elementType:"geometry.stroke",stylers:[{color:"#cccccc"},{lightness:0},{weight:1}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#ffffff"},{lightness:16}]},{featureType:"road.local",elementType:"geometry.stroke",stylers:[{color:"#cccccc"},{lightness:0},{weight:.5}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#f5f5f5"},{lightness:21}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#dedede"},{lightness:21}]},{elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:"#ffffff"},{lightness:16}]},{elementType:"labels.text.fill",stylers:[{saturation:36},{color:"#333333"},{lightness:40}]},{elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#f2f2f2"},{lightness:19}]},{featureType:"transit.station.rail",elementType:"labels.text",stylers:[{lightness:0}]},{featureType:"transit.station.rail",elementType:"labels.icon",stylers:[{visibility:"on"},{hue:"#ff0000"},{saturation:-100},{lightness:0}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#fefefe"},{lightness:20}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#fefefe"},{lightness:17},{weight:1.2}]}]}function w(n){var t=[];return $(n).each(function(){var n={centrName:$(".centr-name",this).val(),centrLat:$(".centr-lat",this).val()*1,centrLng:$(".centr-lng",this).val()*1,centrUrl:$("a.centrs-url",this).attr("href"),centrImg:"//assets.regus.com/images/"+$(".centr-number",this).val()+"/officespace/1_454x340.jpg",centrUrlText:$(".centr-urltext",this).val().trim(),centrPostcode:$(".centr-poscode",this).val()};t.push(n)}),t}function b(n,t){var i,r,u;n.style.padding="25px";i=document.createElement("div");i.style.backgroundColor="black";i.style.borderStyle="solid";i.style.borderColor="black";i.style.borderWidth="0px";i.style.cursor="pointer";i.style.textAlign="center";i.style.width="30px";i.style.height="55px";n.appendChild(i);r=document.createElement("div");r.style.width="30px";r.style.height="30px";r.style.backgroundImage='url("/Images/zoomin-loc.png")';i.appendChild(r);u=document.createElement("div");u.style.width="30px";u.style.height="25px";u.style.backgroundImage='url("/Images/zoomout-loc.png")';i.appendChild(u);google.maps.event.addDomListener(r,"click",function(){t.setZoom(t.getZoom()+1)});google.maps.event.addDomListener(u,"click",function(){t.setZoom(t.getZoom()-1)})}function h(n,t,i,r,u,f,e,o){for(var h=w(o),rt={zoom:t,styles:p(),center:new google.maps.LatLng(h[0].centrLat,h[0].centrLng),disableDefaultUI:!0,scrollwheel:!1},a=new google.maps.Map(document.getElementById(n),rt),v=new InfoBox({closeBoxURL:"",closeBoxMargin:"",alignBottom:!0,pixelOffset:new google.maps.Size(u,f)}),c,y=[],tt=r,k=i,it=new google.maps.LatLngBounds,d=!1,nt,g,ut,l=0;l<h.length;l++)nt=new google.maps.LatLng(h[l].centrLat,h[l].centrLng),c=new google.maps.Marker({position:nt,icon:k,map:a}),it.extend(nt),google.maps.event.addListener(c,"mouseout",function(n){return function(){n!=d&&n.setIcon(k)}}(c,l)),google.maps.event.addListener(c,"mouseover",function(n){return function(){n.setIcon(tt)}}(c,l)),google.maps.event.addListener(c,"click",function(n,t){return function(){var r,i,u;for(v.setContent('<div class="iwwrapper"><div class="iwcentre-name" style="color:#000">'+h[t].centrName+'<\/div><div class="iwpostcode">'+h[t].centrPostcode+'<\/div><div class="iwimg"><img style="width:100%; height:auto" src="'+h[t].centrImg+'" onerror="'+s+'" /><div class="iwmore-btn"><a href="'+h[t].centrUrl+'">'+h[t].centrUrlText+'<\/a><\/div><\/div><div class="iwarrowbot"><\/div><\/div>'),v.open(a,n),r=0;r<y.length;r++)y[r].setIcon(k);n.setIcon(tt);d=n;i=".smartscrollcentres";$(".optimly-tile-format").length&&window.innerWidth>480?(i=".smartscrollcentres",t>1?(u=2,t%u==0?$(i).sly("toStart",t/2):$(i).sly("toStart",(t-1)/2)):$(i).sly("toStart",0)):$(i).sly("toStart",t)}}(c,l)),google.maps.event.addListener(a,"click",function(){v&&v.close();d&&d.setIcon(k)}),y.push(c);y.length>1&&a.fitBounds(it);e&&(g=document.createElement("div"),ut=new b(g,a),g.index=1,a.controls[google.maps.ControlPosition.TOP_LEFT].push(g))}function k(){var r=$(window),u=r.height(),n=$(".header_fixed").outerHeight(),t=$(".loc-filter-wr").outerHeight()+30,f=$("#locsmap-desk-map"),e=$(".horiz-centrescards-wrapper"),i=$("#locsmap-desk"),s=i.offset().top-n,o={height:u-n,width:"100%"};i.css({height:$(window).innerHeight()-t-n});e.css({height:$(window).innerHeight()-t-n});f.css(o)}function i(n){window.innerWidth>767?(k(),h("locsmap-desk-map",13,"/Images/green-pin-locs.png","/Images/red-pin-locs.png",-70,-55,!0,n),a()):(h("locsmap-mobile",12,"/Images/green-pin-locs-mob.png","/Images/red-pin-locs-mob.png",-70,-35,!1,n),slideeSwitch())}function c(n){$(n).each(function(){$(this).remove().appendTo(".loc-temp-storage")})}function f(){l()&&$(".loc-temp-storage .nb-locs").remove().appendTo("#locscontainer")}function e(){l()&&$(".loc-temp-storage .mn-locs").remove().prependTo("#locscontainer")}function l(){return $(".loc-temp-storage").children().length>0}function a(){var n=$("#locationCardSlidee"),u=n.children("div").eq(0),i=n.parent(),t=!1,r;navigator.appVersion.indexOf("Mac OS")>-1&&(t=!0);r=$(".arrowsscrldesktop").length?{horizontal:!1,itemNav:"basic",smart:1,prevPage:$(".slideearrows-totop"),nextPage:$(".slideearrows-tobottom"),scrollSource:n,dragSource:n,mouseDragging:1,touchDragging:1,releaseSwing:1,scrollBar:i.find(".scrollbar"),scrollBy:1,scrollTrap:t,speed:300,elasticBounds:1,dragHandle:1,dynamicHandle:1,clickBar:0}:{horizontal:!1,itemNav:"basic",smart:1,scrollSource:n,dragSource:n,mouseDragging:1,touchDragging:1,releaseSwing:1,scrollBar:i.find(".scrollbar"),scrollBy:1,scrollTrap:t,speed:300,elasticBounds:1,dragHandle:1,dynamicHandle:1,clickBar:0};n.sly(r)}function v(){switch(o){case"all":i(".horizv-map-centrescards");break;case"in":i(".mn-locs");break;case"near":i(".nb-locs");break;default:i(".horizv-map-centrescards")}}function d(){$(".horizv-map-centrescards").each(function(n){$(this).attr("data-order",n)})}function g(){var n=$(".horizv-map-centrescards");n.sort(function(n,t){return $(n).data("order")-$(t).data("order")});$("#locscontainer").html(n)}function nt(){var n=$(".horizv-map-centrescards");n.sort(function(n,t){return $(n).data("min-price")-$(t).data("min-price")});$("#locscontainer").html(n);$(".horizv-map-centrescards").each(function(){console.log($(this).data("min-price"))})}function tt(){var n=$(".horizv-map-centrescards");n.sort(function(n,t){return $(t).data("max-price")-$(n).data("max-price")});$("#locscontainer").html(n);$(".horizv-map-centrescards").each(function(){console.log($(this).data("max-price"))})}function it(n){var e=$("#product-name-data-use").val().trim(),i=1e9,t=".centr-pricing",r="data-min-price",u="data-max-price",f=$("#pricing-format-applied").val().toLowerCase()=="true"?!0:!1;switch(e){case"ManagedOfficeSolutions":case"OfficeSpace":$(n).each(function(){var n={minPrice:JSON.parse($(t,this).val()).OfficePriceRange?JSON.parse($(t,this).val()).OfficePriceRange.From:i,maxPrice:JSON.parse($(t,this).val()).OfficePriceRange?JSON.parse($(t,this).val()).OfficePriceRange.To:0,singleFormatMin:JSON.parse($(t,this).val()).InternalOfficePriceRange?JSON.parse($(t,this).val()).InternalOfficePriceRange.From:i,singleFormatMax:JSON.parse($(t,this).val()).WindowOfficePriceRange?JSON.parse($(t,this).val()).WindowOfficePriceRange.From:0};f?($(this).attr(r,n.singleFormatMin),$(this).attr(u,n.singleFormatMax)):($(this).attr(r,n.minPrice),$(this).attr(u,n.maxPrice))});break;case"VirtualOffice":$(n).each(function(){var n={minPrice:JSON.parse($(t,this).val()).VirtualOfficePriceRange?JSON.parse($(t,this).val()).VirtualOfficePriceRange.From:i,maxPrice:JSON.parse($(t,this).val()).VirtualOfficePriceRange?JSON.parse($(t,this).val()).VirtualOfficePriceRange.To:0,singleFormatMin:JSON.parse($(t,this).val()).VirtualOfficePriceRange?JSON.parse($(t,this).val()).VirtualOfficePriceRange.From:i,singleFormatMax:JSON.parse($(t,this).val()).VirtualOfficePriceRange?JSON.parse($(t,this).val()).VirtualOfficePriceRange.From:0};f?($(this).attr(r,n.singleFormatMin),$(this).attr(u,n.singleFormatMax)):($(this).attr(r,n.minPrice),$(this).attr(u,n.maxPrice))});break;case"CoWorking":$(n).each(function(){var n={minPrice:JSON.parse($(t,this).val()).CoWorkingPriceRange?JSON.parse($(t,this).val()).CoWorkingPriceRange.From:i,maxPrice:JSON.parse($(t,this).val()).CoWorkingPriceRange?JSON.parse($(t,this).val()).CoWorkingPriceRange.From:0};$(this).attr(r,n.minPrice);$(this).attr(u,n.maxPrice)});break;case"MeetingRoom":$(n).each(function(){var n={minPrice:JSON.parse($(t,this).val()).CoWorkingPriceRange?JSON.parse($(t,this).val()).CoWorkingPriceRange.From:i,maxPrice:JSON.parse($(t,this).val()).CoWorkingPriceRange?JSON.parse($(t,this).val()).CoWorkingPriceRange.From:0};$(this).attr(r,n.minPrice);$(this).attr(u,n.maxPrice)});break;case"BusinessWorld":case"BusinessLounge":$(n).each(function(){var n={minPrice:JSON.parse($(t,this).val()).BWGoldDailyFrom?JSON.parse($(t,this).val()).BWGoldDailyFrom.Price:i,maxPrice:JSON.parse($(t,this).val()).BWGoldDailyFrom?JSON.parse($(t,this).val()).BWGoldDailyFrom.Price:0};$(this).attr(r,n.minPrice);$(this).attr(u,n.maxPrice)});break;default:$(n).each(function(){var n={minPrice:JSON.parse($(t,this).val()).OfficePriceRange?JSON.parse($(t,this).val()).OfficePriceRange.From:i,MaxPrice:JSON.parse($(t,this).val()).OfficePriceRange?JSON.parse($(t,this).val()).OfficePriceRange.To:0}})}}function y(){window.innerWidth>480?(a(),$(".smartscrollcentres").sly("reload")):($(".smartscrollcentres").sly(!1),slideeSwitch(),$(".optimly-tile-format").length&&t(".wrapped-slidee-item .horizv-map-centrescards"))}function r(n){o=n;v();rt()}function rt(){$(".smartscrollcentres").sly("reload");$(".smartscrollcentres").sly("toStart",0)}function u(n){n&&n.addClass&&($(".locactive").removeClass("locactive"),n.addClass("locactive"))}function n(){window.innerWidth>480&&(function(){for(var t=$("#locscontainer > div"),n=0;n<t.length;n+=2)t.slice(n,n+2).wrapAll("<div class='wrapped-slidee-item'><\/div>")}(),y())}function t(n){$(n).length&&function(){for(var i=$(n),t=0;t<i.length;t+=2)i.slice(t,t+2).unwrap()}()}var s,o;if($(".zonetotopgrey-width").length&&$(".breadcrumbs").addClass("dark-gr"),s="this.onerror = null; this.src = '/images/gable.jpg';",$(".horizv-map-centrescards").length&&$(".map-locs-cards-desk").length){it(".horizv-map-centrescards");d();$(".breadcrumbs").addClass("dark-gr");i(".horizv-map-centrescards");o="all";$(window).load(function(){$(".optimly-tile-format").length&&n()});$("#locationspseudoselect").click(function(){$(this).toggleClass("rolledout")});$(document).on("click",function(n){$(n.target).closest("#locationspseudoselect").length===0&&($("#locationspseudoselect").removeClass("rolledout"),n.stopPropagation())});$(".selectedloc-opt").on("click",function(){var n=$(this).html();$("#locdropdown-c").html(n)});$("#locdropdown-all").on("click",function(i){(function(){u($(i.target));$(".optimly-tile-format").length&&t(".wrapped-slidee-item .horizv-map-centrescards");e()})();f();g();r("all");$(".optimly-tile-format").length&&n()});$("#locdropdown-in").on("click",function(i){(function(){u($(i.target));$(".optimly-tile-format").length&&t(".wrapped-slidee-item .horizv-map-centrescards");e();c(".nb-locs")})();r("in");$(".optimly-tile-format").length&&n()});$("#locdropdown-near").on("click",function(i){(function(){u($(i.target));$(".optimly-tile-format").length&&t(".wrapped-slidee-item .horizv-map-centrescards");f();c(".mn-locs")})();r("near");$(".optimly-tile-format").length&&n()});$("#locdropdown-lowest").on("click",function(i){(function(){u($(i.target));$(".optimly-tile-format").length&&t(".wrapped-slidee-item .horizv-map-centrescards");e()})();f();nt();r("all");$(".optimly-tile-format").length&&n()});$("#locdropdown-highest").on("click",function(i){(function(){u($(i.target));$(".optimly-tile-format").length&&t(".wrapped-slidee-item .horizv-map-centrescards");e()})();f();tt();r("all");$(".optimly-tile-format").length&&n()})}$(window).resize(function(){$(".horizv-map-centrescards").length&&$(".map-locs-cards-desk").length&&(v(),y())})})