/*
 OverlappingMarkerSpiderfier
 https://github.com/jawj/OverlappingMarkerSpiderfier
 Copyright (c) 2011 - 2017 George MacKerron
 Released under the MIT licence: http://opensource.org/licenses/mit-license
 Note: The Google Maps API v3 must be included *before* this code
 */
(function(){var g,r,w,z,u,A={}.hasOwnProperty,B=[].slice;this.OverlappingMarkerSpiderfier=function(){function t(a,d){var b,f,e;this.map=a;null==d&&(d={});null==this.constructor.N&&(this.constructor.N=!0,k=google.maps,m=k.event,p=k.MapTypeId,c.keepSpiderfied=!1,c.ignoreMapClick=!1,c.markersWontHide=!1,c.markersWontMove=!1,c.basicFormatEvents=!1,c.nearbyDistance=20,c.circleSpiralSwitchover=9,c.circleFootSeparation=23,c.circleStartAngle=x/12,c.spiralFootSeparation=26,c.spiralLengthStart=11,c.spiralLengthFactor=
    4,c.spiderfiedZIndex=k.Marker.MAX_ZINDEX+2E4,c.highlightedLegZIndex=k.Marker.MAX_ZINDEX+1E4,c.usualLegZIndex=k.Marker.MAX_ZINDEX+1,c.legWeight=1.5,c.legColors={usual:{},highlighted:{}},e=c.legColors.usual,f=c.legColors.highlighted,e[p.HYBRID]=e[p.SATELLITE]="#fff",f[p.HYBRID]=f[p.SATELLITE]="#f00",e[p.TERRAIN]=e[p.ROADMAP]="#444",f[p.TERRAIN]=f[p.ROADMAP]="#f00",this.constructor.j=function(a){return this.setMap(a)},this.constructor.j.prototype=new k.OverlayView,this.constructor.j.prototype.draw=function(){});
    for(b in d)A.call(d,b)&&(f=d[b],this[b]=f);this.g=new this.constructor.j(this.map);this.C();this.c={};this.B=this.l=null;this.addListener("click",function(a,b){return m.trigger(a,"spider_click",b)});this.addListener("format",function(a,b){return m.trigger(a,"spider_format",b)});this.ignoreMapClick||m.addListener(this.map,"click",function(a){return function(){return a.unspiderfy()}}(this));m.addListener(this.map,"maptypeid_changed",function(a){return function(){return a.unspiderfy()}}(this));m.addListener(this.map,
        "zoom_changed",function(a){return function(){a.unspiderfy();if(!a.basicFormatEvents)return a.h()}}(this))}var m,k,g,v,p,c,r,x,u;c=t.prototype;r=[t,c];g=0;for(v=r.length;g<v;g++)u=r[g],u.VERSION="1.0.1";x=2*Math.PI;k=m=p=null;t.markerStatus={SPIDERFIED:"SPIDERFIED",SPIDERFIABLE:"SPIDERFIABLE",UNSPIDERFIABLE:"UNSPIDERFIABLE",UNSPIDERFIED:"UNSPIDERFIED"};c.C=function(){this.a=[];this.s=[]};c.addMarker=function(a,d){a.setMap(this.map);return this.trackMarker(a,d)};c.trackMarker=function(a,d){var b;if(null!=
    a._oms)return this;a._oms=!0;b=[m.addListener(a,"click",function(b){return function(d){return b.V(a,d)}}(this))];this.markersWontHide||b.push(m.addListener(a,"visible_changed",function(b){return function(){return b.D(a,!1)}}(this)));this.markersWontMove||b.push(m.addListener(a,"position_changed",function(b){return function(){return b.D(a,!0)}}(this)));null!=d&&b.push(m.addListener(a,"spider_click",d));this.s.push(b);this.a.push(a);this.basicFormatEvents?this.trigger("format",a,this.constructor.markerStatus.UNSPIDERFIED):
    this.h();return this};c.D=function(a,d){if(!this.J&&!this.K)return null==a._omsData||!d&&a.getVisible()||this.unspiderfy(d?a:null),this.h()};c.getMarkers=function(){return this.a.slice(0)};c.removeMarker=function(a){this.forgetMarker(a);return a.setMap(null)};c.forgetMarker=function(a){var d,b,f,e,h;null!=a._omsData&&this.unspiderfy();d=this.A(this.a,a);if(0>d)return this;h=this.s.splice(d,1)[0];b=0;for(f=h.length;b<f;b++)e=h[b],m.removeListener(e);delete a._oms;this.a.splice(d,1);this.h();return this};
    c.removeAllMarkers=c.clearMarkers=function(){var a,d,b,f;f=this.getMarkers();this[forgetAllMarkers]();a=0;for(d=f.length;a<d;a++)b=f[a],b.setMap(null);return this};c.forgetAllMarkers=function(){var a,d,b,f,e,h,c,n;this.unspiderfy();n=this.a;a=d=0;for(b=n.length;d<b;a=++d){h=n[a];e=this.s[a];c=0;for(a=e.length;c<a;c++)f=e[c],m.removeListener(f);delete h._oms}this.C();return this};c.addListener=function(a,d){var b;(null!=(b=this.c)[a]?b[a]:b[a]=[]).push(d);return this};c.removeListener=function(a,d){var b;
        b=this.A(this.c[a],d);0>b||this.c[a].splice(b,1);return this};c.clearListeners=function(a){this.c[a]=[];return this};c.trigger=function(){var a,d,b,f,e,h;d=arguments[0];a=2<=arguments.length?B.call(arguments,1):[];d=null!=(b=this.c[d])?b:[];h=[];f=0;for(e=d.length;f<e;f++)b=d[f],h.push(b.apply(null,a));return h};c.L=function(a,d){var b,f,e,h,c;h=this.circleFootSeparation*(2+a)/x;f=x/a;c=[];for(b=e=0;0<=a?e<a:e>a;b=0<=a?++e:--e)b=this.circleStartAngle+b*f,c.push(new k.Point(d.x+h*Math.cos(b),d.y+h*
        Math.sin(b)));return c};c.M=function(a,d){var b,f,e,c,l;c=this.spiralLengthStart;b=0;l=[];for(f=e=0;0<=a?e<a:e>a;f=0<=a?++e:--e)b+=this.spiralFootSeparation/c+5E-4*f,f=new k.Point(d.x+c*Math.cos(b),d.y+c*Math.sin(b)),c+=x*this.spiralLengthFactor/b,l.push(f);return l};c.V=function(a,d){var b,f,e,c,l,n,y,m,k;(n=null!=a._omsData)&&this.keepSpiderfied||this.unspiderfy();if(n||this.map.getStreetView().getVisible()||"GoogleEarthAPI"===this.map.getMapTypeId())return this.trigger("click",a,d);n=[];y=[];b=
        this.nearbyDistance;m=b*b;l=this.f(a.position);k=this.a;b=0;for(f=k.length;b<f;b++)e=k[b],null!=e.map&&e.getVisible()&&(c=this.f(e.position),this.i(c,l)<m?n.push({R:e,G:c}):y.push(e));return 1===n.length?this.trigger("click",a,d):this.W(n,y)};c.markersNearMarker=function(a,d){var b,f,e,c,l,n,m,k,g,q;null==d&&(d=!1);if(null==this.g.getProjection())throw"Must wait for 'idle' event on map before calling markersNearMarker";b=this.nearbyDistance;m=b*b;l=this.f(a.position);n=[];k=this.a;b=0;for(f=k.length;b<
    f&&!(e=k[b],e!==a&&null!=e.map&&e.getVisible()&&(c=this.f(null!=(g=null!=(q=e._omsData)?q.v:void 0)?g:e.position),this.i(c,l)<m&&(n.push(e),d)));b++);return n};c.F=function(){var a,d,b,f,e,c,l,n,m,k,g;if(null==this.g.getProjection())throw"Must wait for 'idle' event on map before calling markersNearAnyOtherMarker";m=this.nearbyDistance;m*=m;var q;e=this.a;q=[];k=0;for(d=e.length;k<d;k++)f=e[k],q.push({H:this.f(null!=(a=null!=(b=f._omsData)?b.v:void 0)?a:f.position),b:!1});k=this.a;a=b=0;for(f=k.length;b<
    f;a=++b)if(d=k[a],null!=d.getMap()&&d.getVisible()&&(c=q[a],!c.b))for(g=this.a,d=n=0,e=g.length;n<e;d=++n)if(l=g[d],d!==a&&null!=l.getMap()&&l.getVisible()&&(l=q[d],(!(d<a)||l.b)&&this.i(c.H,l.H)<m)){c.b=l.b=!0;break}return q};c.markersNearAnyOtherMarker=function(){var a,d,b,c,e,h,l;e=this.F();h=this.a;l=[];a=d=0;for(b=h.length;d<b;a=++d)c=h[a],e[a].b&&l.push(c);return l};c.setImmediate=function(a){return window.setTimeout(a,0)};c.h=function(){if(!this.basicFormatEvents&&null==this.l)return this.l=
        this.setImmediate(function(a){return function(){a.l=null;return null!=a.g.getProjection()?a.w():null!=a.B?void 0:a.B=m.addListenerOnce(a.map,"idle",function(){return a.w()})}}(this))};c.w=function(){var a,d,b,c,e,h,l;if(this.basicFormatEvents){e=[];d=0;for(b=markers.length;d<b;d++)c=markers[d],a=null!=c._omsData?"SPIDERFIED":"UNSPIDERFIED",e.push(this.trigger("format",c,this.constructor.markerStatus[a]));return e}e=this.F();h=this.a;l=[];a=b=0;for(d=h.length;b<d;a=++b)c=h[a],a=null!=c._omsData?"SPIDERFIED":
        e[a].b?"SPIDERFIABLE":"UNSPIDERFIABLE",l.push(this.trigger("format",c,this.constructor.markerStatus[a]));return l};c.P=function(a){return{m:function(d){return function(){return a._omsData.o.setOptions({strokeColor:d.legColors.highlighted[d.map.mapTypeId],zIndex:d.highlightedLegZIndex})}}(this),u:function(d){return function(){return a._omsData.o.setOptions({strokeColor:d.legColors.usual[d.map.mapTypeId],zIndex:d.usualLegZIndex})}}(this)}};c.W=function(a,d){var b,c,e,h,l,n,g,p,t,q;this.J=!0;q=a.length;
        b=this.T(function(){var b,d,c;c=[];b=0;for(d=a.length;b<d;b++)p=a[b],c.push(p.G);return c}());h=q>=this.circleSpiralSwitchover?this.M(q,b).reverse():this.L(q,b);b=function(){var b,d,f;f=[];b=0;for(d=h.length;b<d;b++)e=h[b],c=this.U(e),t=this.S(a,function(a){return function(b){return a.i(b.G,e)}}(this)),g=t.R,n=new k.Polyline({map:this.map,path:[g.position,c],strokeColor:this.legColors.usual[this.map.mapTypeId],strokeWeight:this.legWeight,zIndex:this.usualLegZIndex}),g._omsData={v:g.position,o:n},
        this.legColors.highlighted[this.map.mapTypeId]!==this.legColors.usual[this.map.mapTypeId]&&(l=this.P(g),g._omsData.O={m:m.addListener(g,"mouseover",l.m),u:m.addListener(g,"mouseout",l.u)}),this.trigger("format",g,this.constructor.markerStatus.SPIDERFIED),g.setPosition(c),g.setZIndex(Math.round(this.spiderfiedZIndex+e.y)),f.push(g);return f}.call(this);delete this.J;this.I=!0;return this.trigger("spiderfy",b,d)};c.unspiderfy=function(a){var d,b,c,e,h,l,g;null==a&&(a=null);if(null==this.I)return this;
        this.K=!0;g=[];h=[];l=this.a;d=0;for(b=l.length;d<b;d++)e=l[d],null!=e._omsData?(e._omsData.o.setMap(null),e!==a&&e.setPosition(e._omsData.v),e.setZIndex(null),c=e._omsData.O,null!=c&&(m.removeListener(c.m),m.removeListener(c.u)),delete e._omsData,e!==a&&(c=this.basicFormatEvents?"UNSPIDERFIED":"SPIDERFIABLE",this.trigger("format",e,this.constructor.markerStatus[c])),g.push(e)):h.push(e);delete this.K;delete this.I;this.trigger("unspiderfy",g,h);return this};c.i=function(a,d){var b,c;b=a.x-d.x;c=
        a.y-d.y;return b*b+c*c};c.T=function(a){var c,b,f,e,h;c=e=h=0;for(b=a.length;c<b;c++)f=a[c],e+=f.x,h+=f.y;a=a.length;return new k.Point(e/a,h/a)};c.f=function(a){return this.g.getProjection().fromLatLngToDivPixel(a)};c.U=function(a){return this.g.getProjection().fromDivPixelToLatLng(a)};c.S=function(a,c){var b,d,e,h,g,k;e=g=0;for(k=a.length;g<k;e=++g)if(h=a[e],h=c(h),"undefined"===typeof b||null===b||h<d)d=h,b=e;return a.splice(b,1)[0]};c.A=function(a,c){var b,d,e,h;if(null!=a.indexOf)return a.indexOf(c);
        b=d=0;for(e=a.length;d<e;b=++d)if(h=a[b],h===c)return b;return-1};return t}();r=/(\?.*(&|&amp;)|\?)spiderfier_callback=(\w+)/;g=document.currentScript;null==g&&(g=function(){var g,m,k,w,v;k=document.getElementsByTagName("script");v=[];g=0;for(m=k.length;g<m;g++)u=k[g],null!=(w=u.getAttribute("src"))&&w.match(r)&&v.push(u);return v}()[0]);if(null!=g&&(g=null!=(w=g.getAttribute("src"))?null!=(z=w.match(r))?z[3]:void 0:void 0)&&"function"===typeof window[g])window[g]();"function"===typeof window.spiderfier_callback&&
window.spiderfier_callback()}).call(this);
/* Wed 5 Apr 2017 09:15:41 BST */
