(function(n,t){function g(){r||(r={verbose:!1,queryLimit:{attempt:5,delay:250,random:250},classes:{Map:google.maps.Map,Marker:google.maps.Marker,InfoWindow:google.maps.InfoWindow,Circle:google.maps.Circle,Rectangle:google.maps.Rectangle,OverlayView:google.maps.OverlayView,StreetViewPanorama:google.maps.StreetViewPanorama,KmlLayer:google.maps.KmlLayer,TrafficLayer:google.maps.TrafficLayer,BicyclingLayer:google.maps.BicyclingLayer,GroundOverlay:google.maps.GroundOverlay,StyledMapType:google.maps.StyledMapType,ImageMapType:google.maps.ImageMapType},map:{mapTypeId:google.maps.MapTypeId.ROADMAP,center:[46.578498,2.457275],zoom:2},overlay:{pane:"floatPane",content:"",offset:{x:0,y:0}},geoloc:{getCurrentPosition:{maximumAge:6e4,timeout:5e3}}})}function s(n,i){return n!==t?n:"gmap3_"+(i?p+1:++p)}function nt(n){var i=function(n){return parseInt(n,10)},r=google.maps.version.split(".").map(i),t;for(n=n.split(".").map(i),t=0;t<n.length;t++)if(r.hasOwnProperty(t)){if(r[t]<n[t])return!1}else return!1;return!0}function f(t,i,r,u,f){if(i.todo.events||i.todo.onces){var e={id:u,data:i.todo.data,tag:i.todo.tag};i.todo.events&&n.each(i.todo.events,function(i,u){var o=t,s=u;n.isArray(u)&&(o=u[0],s=u[1]);google.maps.event.addListener(r,i,function(n){s.apply(o,[f?f:r,n,e])})});i.todo.onces&&n.each(i.todo.onces,function(i,u){var o=t,s=u;n.isArray(u)&&(o=u[0],s=u[1]);google.maps.event.addListenerOnce(r,i,function(n){s.apply(o,[f?f:r,n,e])})})}}function tt(){var n=[];this.empty=function(){return!n.length};this.add=function(t){n.push(t)};this.get=function(){return n.length?n[0]:!1};this.ack=function(){n.shift()}}function it(t,i,u){function h(n){var t={};return t[n]={},t}function c(){var n;for(n in u)if(!(n in f))return n}var f={},o=this,s,e={latLng:{map:!1,marker:!1,infowindow:!1,circle:!1,overlay:!1,getlatlng:!1,getmaxzoom:!1,getelevation:!1,streetviewpanorama:!1,getaddress:!0},geoloc:{getgeoloc:!0}};typeof u=="string"&&(u=h(u));this.run=function(){for(var o,h;o=c();){if(typeof t[o]=="function"){s=o;h=n.extend(!0,{},r[o]||{},u[o].options||{});o in e.latLng?u[o].values?at(u[o].values,t,t[o],{todo:u[o],opts:h,session:f}):y(t,t[o],e.latLng[o],{todo:u[o],opts:h,session:f}):o in e.geoloc?vt(t,t[o],{todo:u[o],opts:h,session:f}):t[o].apply(t,[{todo:u[o],opts:h,session:f}]);return}f[o]=null}i.apply(t,[u,f])};this.ack=function(n){f[s]=n;o.run.apply(o,[])}}function w(n){var t,i=[];for(t in n)i.push(t);return i}function o(t,i){var u={},r,f,e;if(t.todo)for(r in t.todo)r!=="options"&&r!=="values"&&(u[r]=t.todo[r]);for(e=["data","tag","id","events","onces"],f=0;f<e.length;f++)rt(u,e[f],i,t.todo);return u.options=n.extend({},t.opts||{},i.options||{}),u}function rt(n,t){for(var i=2;i<arguments.length;i++)if(t in arguments[i]){n[t]=arguments[i][t];return}}function ut(){var n=[];this.get=function(t){if(n.length)for(var e,i,r,u,o=w(t),f=0;f<n.length;f++){for(r=n[f],u=o.length==r.keys.length,e=0;e<o.length&&u;e++)i=o[e],u=i in r.request,u&&(u=typeof t[i]=="object"&&"equals"in t[i]&&typeof t[i]=="function"?t[i].equals(r.request[i]):t[i]===r.request[i]);if(u)return r.results}};this.store=function(t,i){n.push({request:t,keys:w(t),results:i})}}function h(t,i,u,f){var e=this,o=[];r.classes.OverlayView.call(this);this.setMap(t);this.onAdd=function(){var t=this.getPanes();i.pane in t&&n(t[i.pane]).append(f);n.each("dblclick click mouseover mousemove mouseout mouseup mousedown".split(" "),function(t,i){o.push(google.maps.event.addDomListener(f[0],i,function(t){n.Event(t).stopPropagation();google.maps.event.trigger(e,i,[t]);e.draw()}))});o.push(google.maps.event.addDomListener(f[0],"contextmenu",function(t){n.Event(t).stopPropagation();google.maps.event.trigger(e,"rightclick",[t]);e.draw()}))};this.getPosition=function(){return u};this.draw=function(){var n=this.getProjection().fromLatLngToDivPixel(u);f.css("left",n.x+i.offset.x+"px").css("top",n.y+i.offset.y+"px")};this.onRemove=function(){for(var n=0;n<o.length;n++)google.maps.event.removeListener(o[n]);f.remove()};this.hide=function(){f.hide()};this.show=function(){f.show()};this.toggle=function(){f&&(f.is(":visible")?this.show():this.hide())};this.toggleDOM=function(){this.getMap()?this.setMap(null):this.setMap(t)};this.getDOMElement=function(){return f[0]}}function ft(n){function t(){return this.onAdd=function(){},this.onRemove=function(){},this.draw=function(){},r.classes.OverlayView.apply(this,[])}t.prototype=r.classes.OverlayView.prototype;var i=new t;return i.setMap(n),i}function et(t,i,u){function ut(n){o[n]||(delete e[n].options.map,o[n]=new r.classes.Marker(e[n].options),f(t,{todo:e[n]},o[n],e[n].id))}function et(){if(w=ct.getProjection(),!w){setTimeout(function(){et.apply(ht,[])},25);return}tt=!0;y.push(google.maps.event.addListener(i,"zoom_changed",function(){st()}));y.push(google.maps.event.addListener(i,"bounds_changed",function(){st()}));b()}function ot(n){typeof h[n]=="object"?(typeof h[n].obj.setMap=="function"&&h[n].obj.setMap(null),typeof h[n].obj.remove=="function"&&h[n].obj.remove(),typeof h[n].shadow.remove=="function"&&h[n].obj.remove(),typeof h[n].shadow.setMap=="function"&&h[n].shadow.setMap(null),delete h[n].obj,delete h[n].shadow):o[n]&&o[n].setMap(null);delete h[n]}function at(){var u,n,f,t,i,e,r,o;return arguments[0]instanceof google.maps.LatLng?(u=arguments[0].lat(),f=arguments[0].lng(),arguments[1]instanceof google.maps.LatLng?(n=arguments[1].lat(),t=arguments[1].lng()):(n=arguments[1],t=arguments[2])):(u=arguments[0],f=arguments[1],arguments[2]instanceof google.maps.LatLng?(n=arguments[2].lat(),t=arguments[2].lng()):(n=arguments[2],t=arguments[3])),i=Math.PI*u/180,e=Math.PI*f/180,r=Math.PI*n/180,o=Math.PI*t/180,6371e3*Math.acos(Math.min(Math.cos(i)*Math.cos(r)*Math.cos(e)*Math.cos(o)+Math.cos(i)*Math.sin(e)*Math.cos(r)*Math.sin(o)+Math.sin(i)*Math.sin(r),1))}function vt(){var n=at(i.getCenter(),i.getBounds().getNorthEast()),t=new google.maps.Circle({center:i.getCenter(),radius:1.25*n});return t.getBounds()}function yt(){var n={},t;for(t in h)n[t]=!0;return n}function st(){clearTimeout(it);it=setTimeout(function(){b()},25)}function pt(n){var t=w.fromLatLngToDivPixel(n),i=w.fromDivPixelToLatLng(new google.maps.Point(t.x+u.radius,t.y-u.radius)),r=w.fromDivPixelToLatLng(new google.maps.Point(t.x-u.radius,t.y+u.radius));return new google.maps.LatLngBounds(r,i)}function b(){if(!k&&!nt&&tt){var f=[],y={},ft=i.getZoom(),ht="maxZoom"in u&&ft>u.maxZoom,b=yt(),r,o,c,t,et=!1,l,s,st,it,p,w,ut;for(v=!1,ft>3&&(l=vt(),et=l.getSouthWest().lng()<l.getNorthEast().lng()),r=0;r<e.length;r++)e[r]&&(!et||l.contains(e[r].options.position))&&(!g||g(a[r]))&&f.push(r);for(;;){for(r=0;y[r]&&r<f.length;)r++;if(r==f.length)break;if(t=[],d&&!ht){ut=10;do for(it=t,t=[],ut--,st=it.length?l.getCenter():e[f[r]].options.position,l=pt(st),o=r;o<f.length;o++)y[o]||l.contains(e[f[o]].options.position)&&t.push(o);while(it.length<t.length&&t.length>1&&ut)}else for(o=r;o<f.length;o++)if(!y[o]){t.push(o);break}for(s={indexes:[],ref:[]},p=w=0,c=0;c<t.length;c++)y[t[c]]=!0,s.indexes.push(f[t[c]]),s.ref.push(f[t[c]]),p+=e[f[t[c]]].options.position.lat(),w+=e[f[t[c]]].options.position.lng();p/=t.length;w/=t.length;s.latLng=new google.maps.LatLng(p,w);s.ref=s.ref.join("-");s.ref in b?delete b[s.ref]:(t.length===1&&(h[s.ref]=!0),rt(s))}n.each(b,function(n){ot(n)});nt=!1}}var k=!1,v=!1,nt=!1,tt=!1,d=!0,ht=this,y=[],h={},l={},p={},o=[],e=[],a=[],ct=ft(i,u.radius),it,w,g,rt,lt;et();this.getById=function(n){return n in l?(ut(l[n]),o[l[n]]):!1};this.rm=function(n){var t=l[n];o[t]&&o[t].setMap(null);delete o[t];o[t]=!1;delete e[t];e[t]=!1;delete a[t];a[t]=!1;delete l[n];delete p[t];v=!0};this.clearById=function(n){if(n in l)return this.rm(n),!0};this.clear=function(n,t,i){var f,o,s,r,u,h=[],l=c(i);for(n?(f=e.length-1,o=-1,s=-1):(f=0,o=e.length,s=1),r=f;r!=o;r+=s)if(e[r]&&(!l||l(e[r].tag))&&(h.push(p[r]),t||n))break;for(u=0;u<h.length;u++)this.rm(h[u])};this.add=function(n,t){n.id=s(n.id);this.clearById(n.id);l[n.id]=o.length;p[o.length]=n.id;o.push(null);e.push(n);a.push(t);v=!0};this.addMarker=function(n,i){i=i||{};i.id=s(i.id);this.clearById(i.id);i.options||(i.options={});i.options.position=n.getPosition();f(t,{todo:i},n,i.id);l[i.id]=o.length;p[o.length]=i.id;o.push(n);e.push(i);a.push(i.data||{});v=!0};this.todo=function(n){return e[n]};this.value=function(n){return a[n]};this.marker=function(n){return n in o?(ut(n),o[n]):!1};this.markerIsSet=function(n){return Boolean(o[n])};this.setMarker=function(n,t){o[n]=t};this.store=function(n,t,i){h[n.ref]={obj:t,shadow:i}};this.free=function(){for(var t=0;t<y.length;t++)google.maps.event.removeListener(y[t]);y=[];n.each(h,function(n){ot(n)});h={};n.each(e,function(n){e[n]=null});e=[];n.each(o,function(n){o[n]&&(o[n].setMap(null),delete o[n])});o=[];n.each(a,function(n){delete a[n]});a=[];l={};p={}};this.filter=function(n){g=n;b()};this.enable=function(n){d!=n&&(d=n,b())};this.display=function(n){rt=n};this.error=function(n){lt=n};this.beginUpdate=function(){k=!0};this.endUpdate=function(){k=!1;v&&b()};this.autofit=function(n){for(var t=0;t<e.length;t++)e[t]&&n.extend(e[t].options.position)}}function a(n,t){this.id=function(){return n};this.filter=function(n){t.filter(n)};this.enable=function(){t.enable(!0)};this.disable=function(){t.enable(!1)};this.add=function(n,i,r){r||t.beginUpdate();t.addMarker(n,i);r||t.endUpdate()};this.getById=function(n){return t.getById(n)};this.clearById=function(n,i){var r;return i||t.beginUpdate(),r=t.clearById(n),i||t.endUpdate(),r};this.clear=function(n,i,r,u){u||t.beginUpdate();t.clear(n,i,r);u||t.endUpdate()}}function ot(){function u(n){return{id:n.id,name:n.name,object:n.obj,tag:n.tag,data:n.data}}function f(n){typeof n.setMap=="function"&&n.setMap(null);typeof n.remove=="function"&&n.remove();typeof n.free=="function"&&n.free();n=null}var i={},r={};this.add=function(n,t,u,f){var o=n.todo||{},e=s(o.id);return i[t]||(i[t]=[]),e in r&&this.clearById(e),r[e]={obj:u,sub:f,name:t,id:e,tag:o.tag,data:o.data},i[t].push(e),e};this.getById=function(n,t,i){return n in r?t?r[n].sub:i?u(r[n]):r[n].obj:!1};this.get=function(n,t,f,e){var s,o,h=c(f);if(!i[n]||!i[n].length)return null;for(s=i[n].length;s;)if(s--,o=i[n][t?s:i[n].length-s-1],o&&r[o]){if(h&&!h(r[o].tag))continue;return e?u(r[o]):r[o].obj}return null};this.all=function(n,f,e){var o=[],s=c(f),h=function(n){for(var t,f=0;f<i[n].length;f++)if(t=i[n][f],t&&r[t]){if(s&&!s(r[t].tag))continue;o.push(e?u(r[t]):r[t].obj)}};if(n in i)h(n);else if(n===t)for(n in i)h(n);return o};this.rm=function(n,t,u){var f,e;if(!i[n])return!1;if(t){if(u){for(f=i[n].length-1;f>=0;f--)if(e=i[n][f],t(r[e].tag))break}else for(f=0;f<i[n].length;f++)if(e=i[n][f],t(r[e].tag))break}else f=u?i[n].length-1:0;return(f in i[n])?this.clearById(i[n][f],f):!1};this.clearById=function(n,u){if(n in r){for(var o=r[n].name,e=0;u===t&&e<i[o].length;e++)n===i[o][e]&&(u=e);return f(r[n].obj),r[n].sub&&f(r[n].sub),delete r[n],i[o].splice(u,1),!0}return!1};this.objGetById=function(n){var t,u;if(i.clusterer)for(u in i.clusterer)if((t=r[i.clusterer[u]].obj.getById(n))!==!1)return t;return!1};this.objClearById=function(n){if(i.clusterer)for(var t in i.clusterer)if(r[i.clusterer[t]].obj.clearById(n))return!0;return null};this.clear=function(n,t,r,u){var h,f,o,s=c(u);if(n&&n.length)n=e(n);else{n=[];for(h in i)n.push(h)}for(f=0;f<n.length;f++)if(o=n[f],t)this.rm(o,s,!0);else if(r)this.rm(o,s,!1);else while(this.rm(o,s,!1));};this.objClear=function(t,u,f,e){if(i.clusterer&&(n.inArray("marker",t)>=0||!t.length))for(var o in i.clusterer)r[i.clusterer[o]].obj.clear(u,f,e)}}function st(){return u.geocoder||(u.geocoder=new google.maps.Geocoder),u.geocoder}function ht(){return u.directionsService||(u.directionsService=new google.maps.DirectionsService),u.directionsService}function k(){return u.elevationService||(u.elevationService=new google.maps.ElevationService),u.elevationService}function ct(){return u.maxZoomService||(u.maxZoomService=new google.maps.MaxZoomService),u.maxZoomService}function lt(){return u.distanceMatrixService||(u.distanceMatrixService=new google.maps.DistanceMatrixService),u.distanceMatrixService}function d(){if(r.verbose){var n,t=[];if(window.console&&typeof console.error=="function"){for(n=0;n<arguments.length;n++)t.push(arguments[n]);console.error.apply(console,t)}else{for(t="",n=0;n<arguments.length;n++)t+=arguments[n].toString()+" ";alert(t)}}}function v(n){return(typeof n=="number"||typeof n=="string")&&n!==""&&!isNaN(n)}function e(n){var r,i=[];if(n!==t)if(typeof n=="object")if(typeof n.length=="number")i=n;else for(r in n)i.push(n[r]);else i.push(n);return i}function c(i){if(i)return typeof i=="function"?i:(i=e(i),function(r){if(r===t)return!1;if(typeof r=="object"){for(var u=0;u<r.length;u++)if(n.inArray(r[u],i)>=0)return!0;return!1}return n.inArray(r,i)>=0})}function i(t,r,u){var f=r?t:null;return!t||typeof t=="string"?f:t.latLng?i(t.latLng):t instanceof google.maps.LatLng?t:v(t.lat)?new google.maps.LatLng(t.lat,t.lng):!u&&n.isArray(t)?!v(t[0])||!v(t[1])?f:new google.maps.LatLng(t[0],t[1]):f}function l(t){var r,u;return!t||t instanceof google.maps.LatLngBounds?t||null:(n.isArray(t)?t.length==2?(r=i(t[0]),u=i(t[1])):t.length==4&&(r=i([t[0],t[1]]),u=i([t[2],t[3]])):"ne"in t&&"sw"in t?(r=i(t.ne),u=i(t.sw)):"n"in t&&"e"in t&&"s"in t&&"w"in t&&(r=i([t.n,t.e]),u=i([t.s,t.w])),r&&u)?new google.maps.LatLngBounds(u,r):null}function y(n,t,u,f,e){var h=u?i(f.todo,!1,!0):!1,o=h?{latLng:h}:f.todo.address?typeof f.todo.address=="string"?{address:f.todo.address}:f.todo.address:!1,s=o?b.get(o):!1,c=this;o?(e=e||0,s?(f.latLng=s.results[0].geometry.location,f.results=s.results,f.status=s.status,t.apply(n,[f])):(o.location&&(o.location=i(o.location)),o.bounds&&(o.bounds=l(o.bounds)),st().geocode(o,function(i,s){s===google.maps.GeocoderStatus.OK?(b.store(o,{results:i,status:s}),f.latLng=i[0].geometry.location,f.results=i,f.status=s,t.apply(n,[f])):s===google.maps.GeocoderStatus.OVER_QUERY_LIMIT&&e<r.queryLimit.attempt?setTimeout(function(){y.apply(c,[n,t,u,f,e+1])},r.queryLimit.delay+Math.floor(Math.random()*r.queryLimit.random)):(d("geocode failed",s,o),f.latLng=f.results=!1,f.status=s,t.apply(n,[f]))}))):(f.latLng=i(f.todo,!1,!0),t.apply(n,[f]))}function at(t,i,r,u){function o(){do f++;while(f<t.length&&!("address"in t[f]));if(f>=t.length){r.apply(i,[u]);return}y(e,function(i){delete i.todo;n.extend(t[f],i);o.apply(e,[])},!0,{todo:t[f]})}var e=this,f=-1;o()}function vt(n,t,i){var r=!1;navigator&&navigator.geolocation?navigator.geolocation.getCurrentPosition(function(u){r||(r=!0,i.latLng=new google.maps.LatLng(u.coords.latitude,u.coords.longitude),t.apply(n,[i]))},function(){r||(r=!0,i.latLng=!1,t.apply(n,[i]))},i.opts.getCurrentPosition):(i.latLng=!1,t.apply(n,[i]))}function yt(u){function ut(){!p&&(p=rt.get())&&p.run()}function st(){p=null;rt.ack();ut.call(g)}function b(t){if(t.todo.callback){var i=Array.prototype.slice.call(arguments,1);typeof t.todo.callback=="function"?t.todo.callback.apply(u,i):n.isArray(t.todo.callback)&&typeof t.todo.callback[1]=="function"&&t.todo.callback[1].apply(t.todo.callback[0],i)}}function y(n,t,i){i&&f(u,n,t,i);b(n,t);p.ack(t)}function w(t,f){if(f=f||{},c)f.todo&&f.todo.options&&(f.todo.options.center&&(f.todo.options.center=i(f.todo.options.center)),c.setOptions(f.todo.options));else{var e=f.opts||n.extend(!0,{},r.map,f.todo&&f.todo.options?f.todo.options:{});e.center=t||i(e.center);c=new r.classes.Map(u.get(0),e)}}function ft(t,r,e){var s=[],h="values"in t.todo;if(h||(t.todo.values=[{options:t.opts}]),!t.todo.values.length){y(t,!1);return}w();n.each(t.todo.values,function(h,l){var b,y,p,w,a=o(t,l);if(a.options[e])if(a.options[e][0][0]&&n.isArray(a.options[e][0][0]))for(y=0;y<a.options[e].length;y++)for(p=0;p<a.options[e][y].length;p++)a.options[e][y][p]=i(a.options[e][y][p]);else for(y=0;y<a.options[e].length;y++)a.options[e][y]=i(a.options[e][y]);a.options.map=c;w=new google.maps[r](a.options);s.push(w);b=v.add({todo:a},r.toLowerCase(),w);f(u,{todo:a},w,b)});y(t,h?s:s[0])}function at(r){var o=new et(u,c,r),s={},h={},l=[],a,e;for(e in r)/^[0-9]+$/.test(e)?(l.push(1*e),h[e]=r[e],h[e].width=h[e].width||0,h[e].height=h[e].height||0):s[e]=r[e];return l.sort(function(n,t){return n>t}),a=s.calculator?function(t){var i=[];return n.each(t,function(n,t){i.push(o.value(t))}),s.calculator.apply(u,[i])}:function(n){return n.length},o.error(function(){d.apply(g,arguments)}),o.display(function(e){var w,v,y,b,p,k=a(e.indexes);if(r.force||k>1)for(w=0;w<l.length;w++)l[w]<=k&&(v=h[l[w]]);v?(p=v.offset||[-v.width/2,-v.height/2],y=n.extend({},s),y.options=n.extend({pane:"overlayLayer",content:v.content?v.content.replace("CLUSTER_COUNT",k):"",offset:{x:("x"in p?p.x:p[0])||0,y:("y"in p?p.y:p[1])||0}},s.options||{}),b=g.overlay({todo:y,opts:y.options,latLng:i(e)},!0),y.options.pane="floatShadow",y.options.content=n(document.createElement("div")).width(v.width+"px").height(v.height+"px").css({cursor:"pointer"}),shadow=g.overlay({todo:y,opts:y.options,latLng:i(e)},!0),s.data={latLng:i(e),markers:[]},n.each(e.indexes,function(n,t){s.data.markers.push(o.value(t));o.markerIsSet(t)&&o.marker(t).setMap(null)}),f(u,{todo:s},shadow,t,{main:b,shadow:shadow}),o.store(e,b,shadow)):n.each(e.indexes,function(n,t){o.marker(t).setMap(c)})}),o}var g=this,rt=new tt,v=new ot,c=null,p;this._plan=function(n){for(var t=0;t<n.length;t++)rt.add(new it(g,st,n[t]));ut()};this.map=function(n){w(n.latLng,n);f(u,n,c);y(n,c)};this.destroy=function(n){v.clear();u.empty();c&&(c=null);y(n,!0)};this.infowindow=function(e){var s=[],h="values"in e.todo;h||(e.latLng&&(e.opts.position=e.latLng),e.todo.values=[{options:e.opts}]);n.each(e.todo.values,function(n,l){var p,y,a=o(e,l);a.options.position=a.options.position?i(a.options.position):i(l.latLng);c||w(a.options.position);y=new r.classes.InfoWindow(a.options);y&&(a.open===t||a.open)&&(h?y.open(c,a.anchor?a.anchor:t):y.open(c,a.anchor?a.anchor:e.latLng?t:e.session.marker?e.session.marker:t));s.push(y);p=v.add({todo:a},"infowindow",y);f(u,{todo:a},y,p)});y(e,h?s:s[0])};this.circle=function(t){var e=[],s="values"in t.todo;if(s||(t.opts.center=t.latLng||i(t.opts.center),t.todo.values=[{options:t.opts}]),!t.todo.values.length){y(t,!1);return}n.each(t.todo.values,function(n,s){var a,l,h=o(t,s);h.options.center=h.options.center?i(h.options.center):i(s);c||w(h.options.center);h.options.map=c;l=new r.classes.Circle(h.options);e.push(l);a=v.add({todo:h},"circle",l);f(u,{todo:h},l,a)});y(t,s?e:e[0])};this.overlay=function(t,e){var s=[],l="values"in t.todo;if(l||(t.todo.values=[{latLng:t.latLng,options:t.opts}]),!t.todo.values.length){y(t,!1);return}if(h.__initialised||(h.prototype=new r.classes.OverlayView,h.__initialised=!0),n.each(t.todo.values,function(r,l){var w,a,y=o(t,l),p=n(document.createElement("div")).css({border:"none",borderWidth:"0px",position:"absolute"});p.append(y.options.content);a=new h(c,y.options,i(y)||i(l),p);s.push(a);p=null;e||(w=v.add(t,"overlay",a),f(u,{todo:y},a,w))}),e)return s[0];y(t,l?s:s[0])};this.getaddress=function(n){b(n,n.results,n.status);p.ack()};this.getlatlng=function(n){b(n,n.results,n.status);p.ack()};this.getmaxzoom=function(n){ct().getMaxZoomAtLatLng(n.latLng,function(t){b(n,t.status===google.maps.MaxZoomStatus.OK?t.zoom:!1,status);p.ack()})};this.getelevation=function(n){var r,t=[],u=function(t,i){b(n,i===google.maps.ElevationStatus.OK?t:!1,i);p.ack()};if(n.latLng)t.push(n.latLng);else for(t=e(n.todo.locations||[]),r=0;r<t.length;r++)t[r]=i(t[r]);if(t.length)k().getElevationForLocations({locations:t},u);else{if(n.todo.path&&n.todo.path.length)for(r=0;r<n.todo.path.length;r++)t.push(i(n.todo.path[r]));t.length?k().getElevationAlongPath({path:t,samples:n.todo.samples},u):p.ack()}};this.defaults=function(t){n.each(t.todo,function(t,i){r[t]=typeof r[t]=="object"?n.extend({},r[t],i):i});p.ack(!0)};this.rectangle=function(t){var i=[],e="values"in t.todo;if(e||(t.todo.values=[{options:t.opts}]),!t.todo.values.length){y(t,!1);return}n.each(t.todo.values,function(n,e){var a,h,s=o(t,e);s.options.bounds=s.options.bounds?l(s.options.bounds):l(e);c||w(s.options.bounds.getCenter());s.options.map=c;h=new r.classes.Rectangle(s.options);i.push(h);a=v.add({todo:s},"rectangle",h);f(u,{todo:s},h,a)});y(t,e?i:i[0])};this.polyline=function(n){ft(n,"Polyline","path")};this.polygon=function(n){ft(n,"Polygon","paths")};this.trafficlayer=function(n){w();var t=v.get("trafficlayer");t||(t=new r.classes.TrafficLayer,t.setMap(c),v.add(n,"trafficlayer",t));y(n,t)};this.bicyclinglayer=function(n){w();var t=v.get("bicyclinglayer");t||(t=new r.classes.BicyclingLayer,t.setMap(c),v.add(n,"bicyclinglayer",t));y(n,t)};this.groundoverlay=function(n){n.opts.bounds=l(n.opts.bounds);n.opts.bounds&&w(n.opts.bounds.getCenter());var i,t=new r.classes.GroundOverlay(n.opts.url,n.opts.bounds,n.opts.opts);t.setMap(c);i=v.add(n,"groundoverlay",t);y(n,t,i)};this.streetviewpanorama=function(t){t.opts.opts||(t.opts.opts={});t.latLng?t.opts.opts.position=t.latLng:t.opts.opts.position&&(t.opts.opts.position=i(t.opts.opts.position));t.todo.divId?t.opts.container=document.getElementById(t.todo.divId):t.opts.container&&(t.opts.container=n(t.opts.container).get(0));var f,u=new r.classes.StreetViewPanorama(t.opts.container,t.opts.opts);u&&c.setStreetView(u);f=v.add(t,"streetviewpanorama",u);y(t,u,f)};this.kmllayer=function(t){var i=[],e="values"in t.todo;if(e||(t.todo.values=[{options:t.opts}]),!t.todo.values.length){y(t,!1);return}n.each(t.todo.values,function(n,e){var a,l,s,h=o(t,e);c||w();s=h.options;h.options.opts&&(s=h.options.opts,h.options.url&&(s.url=h.options.url));s.map=c;l=nt("3.10")?new r.classes.KmlLayer(s):new r.classes.KmlLayer(s.url,s);i.push(l);a=v.add({todo:h},"kmllayer",l);f(u,{todo:h},l,a)});y(t,e?i:i[0])};this.panel=function(i){w();var s,e=0,o=0,f,r=n(document.createElement("div"));r.css({position:"absolute",zIndex:1e3,visibility:"hidden"});i.opts.content&&(f=n(i.opts.content),r.append(f),u.first().prepend(r),i.opts.left!==t?e=i.opts.left:i.opts.right!==t?e=u.width()-f.width()-i.opts.right:i.opts.center&&(e=(u.width()-f.width())/2),i.opts.top!==t?o=i.opts.top:i.opts.bottom!==t?o=u.height()-f.height()-i.opts.bottom:i.opts.middle&&(o=(u.height()-f.height())/2),r.css({top:o,left:e,visibility:"visible"}));s=v.add(i,"panel",r);y(i,r,s);r=null};this.marker=function(t){var b="values"in t.todo,h=!c,l,e,p;if(b||(t.opts.position=t.latLng||i(t.opts.position),t.todo.values=[{options:t.opts}]),!t.todo.values.length){y(t,!1);return}if(h&&w(),t.todo.cluster&&!c.getBounds()){google.maps.event.addListenerOnce(c,"bounds_changed",function(){g.marker.apply(g,[t])});return}t.todo.cluster?(t.todo.cluster instanceof a?(l=t.todo.cluster,e=v.getById(l.id(),!0)):(e=at(t.todo.cluster),l=new a(s(t.todo.id,!0),e),v.add(t,"clusterer",l,e)),e.beginUpdate(),n.each(t.todo.values,function(n,r){var u=o(t,r);u.options.position=u.options.position?i(u.options.position):i(r);u.options.map=c;h&&(c.setCenter(u.options.position),h=!1);e.add(u,r)}),e.endUpdate(),y(t,l)):(p=[],n.each(t.todo.values,function(n,e){var a,l,s=o(t,e);s.options.position=s.options.position?i(s.options.position):i(e);s.options.map=c;h&&(c.setCenter(s.options.position),h=!1);l=new r.classes.Marker(s.options);p.push(l);a=v.add({todo:s},"marker",l);f(u,{todo:s},l,a)}),y(t,b?p:p[0]))};this.getroute=function(n){n.opts.origin=i(n.opts.origin,!0);n.opts.destination=i(n.opts.destination,!0);ht().route(n.opts,function(t,i){b(n,i==google.maps.DirectionsStatus.OK?t:!1,i);p.ack()})};this.directionsrenderer=function(t){t.opts.map=c;var r,i=new google.maps.DirectionsRenderer(t.opts);t.todo.divId?i.setPanel(document.getElementById(t.todo.divId)):t.todo.container&&i.setPanel(n(t.todo.container).get(0));r=v.add(t,"directionsrenderer",i);y(t,i,r)};this.getgeoloc=function(n){y(n,n.latLng)};this.styledmaptype=function(n){w();var t=new r.classes.StyledMapType(n.todo.styles,n.opts);c.mapTypes.set(n.todo.id,t);y(n,t)};this.imagemaptype=function(n){w();var t=new r.classes.ImageMapType(n.opts);c.mapTypes.set(n.todo.id,t);y(n,t)};this.autofit=function(t){var i=new google.maps.LatLngBounds;n.each(v.all(),function(n,t){t.getPosition?i.extend(t.getPosition()):t.getBounds?(i.extend(t.getBounds().getNorthEast()),i.extend(t.getBounds().getSouthWest())):t.getPaths?t.getPaths().forEach(function(n){n.forEach(function(n){i.extend(n)})}):t.getPath?t.getPath().forEach(function(n){i.extend(n);""}):t.getCenter?i.extend(t.getCenter()):t instanceof a&&(t=v.getById(t.id(),!0),t&&t.autofit(i))});i.isEmpty()||c.getBounds()&&c.getBounds().equals(i)||("maxZoom"in t.todo&&google.maps.event.addListenerOnce(c,"bounds_changed",function(){this.getZoom()>t.todo.maxZoom&&this.setZoom(t.todo.maxZoom)}),c.fitBounds(i));y(t,!0)};this.clear=function(t){if(typeof t.todo=="string"){if(v.clearById(t.todo)||v.objClearById(t.todo)){y(t,!0);return}t.todo={name:t.todo}}t.todo.id?n.each(e(t.todo.id),function(n,t){v.clearById(t)||v.objClearById(t)}):(v.clear(e(t.todo.name),t.todo.last,t.todo.first,t.todo.tag),v.objClear(e(t.todo.name),t.todo.last,t.todo.first,t.todo.tag));y(t,!0)};this.exec=function(t){var i=this;n.each(e(t.todo.func),function(r,f){n.each(i.get(t.todo,!0,t.todo.hasOwnProperty("full")?t.todo.full:!0),function(n,t){f.call(u,t)})});y(t,!0)};this.get=function(i,r,u){var s,f,o=r?i:i.todo;if(r||(u=o.full),typeof o=="string"?(f=v.getById(o,!1,u)||v.objGetById(o),f===!1&&(s=o,o={})):s=o.name,s==="map"&&(f=c),f||(f=[],o.id?(n.each(e(o.id),function(n,t){f.push(v.getById(t,!1,u)||v.objGetById(t))}),n.isArray(o.id)||(f=f[0])):(n.each(s?e(s):[t],function(t,i){var r;o.first?(r=v.get(i,!1,o.tag,u),r&&f.push(r)):o.all?n.each(v.all(i,o.tag,u),function(n,t){f.push(t)}):(r=v.get(i,!0,o.tag,u),r&&f.push(r))}),o.all||n.isArray(s)||(f=f[0]))),f=n.isArray(f)||!o.all?f:[f],r)return f;y(i,f)};this.getdistance=function(n){var t;for(n.opts.origins=e(n.opts.origins),t=0;t<n.opts.origins.length;t++)n.opts.origins[t]=i(n.opts.origins[t],!0);for(n.opts.destinations=e(n.opts.destinations),t=0;t<n.opts.destinations.length;t++)n.opts.destinations[t]=i(n.opts.destinations[t],!0);lt().getDistanceMatrix(n.opts,function(t,i){b(n,i===google.maps.DistanceMatrixStatus.OK?t:!1,i);p.ack()})};this.trigger=function(t){if(typeof t.todo=="string")google.maps.event.trigger(c,t.todo);else{var i=[c,t.todo.eventName];t.todo.var_args&&n.each(t.todo.var_args,function(n,t){i.push(t)});google.maps.event.trigger.apply(google.maps.event,i)}b(t);p.ack()}}function pt(n){var t;if(!1||!n.hasOwnProperty("get"))return!1;for(t in n)if(t!=="get")return!1;return!n.get.hasOwnProperty("callback")}var r,p=0,u={},b=new ut;n.fn.gmap3=function(){var r,t=[],u=!0,i=[];for(g(),r=0;r<arguments.length;r++)arguments[r]&&t.push(arguments[r]);return(t.length||t.push("map"),n.each(this,function(){var f=n(this),r=f.data("gmap3");u=!1;r||(r=new yt(f),f.data("gmap3",r));t.length===1&&(t[0]==="get"||pt(t[0]))?t[0]==="get"?i.push(r.get("map",!0)):i.push(r.get(t[0].get,!0,t[0].get.full)):r._plan(t)}),i.length)?i.length===1?i[0]:i:this}})(jQuery),function(n,t){typeof define=="function"&&define.amd?define(["jquery",],t):typeof module=="object"&&module.exports?module.exports=t(require("jquery")):n.storeLocatorMap=t(n.jQuery)}(this,function(n){function i(){n=window.jQuery}function r(){var h=n.QueryString.s,t=n("#storeMap"),e=n("#addressInput"),o=n("#radiusSelect"),i=n(".searchStoreError"),r=s(".listStore");n("#addressInput").val()!=""&&n("#storeSearch").trigger("click");t.gmap3({map:{options:{center:[t.data("startlat"),t.data("startlong")],zoom:t.data("startzoom")||5,navigationControl:!0,scrollwheel:!0,streetViewControl:!0}},marker:{values:r.stores,options:{icon:new google.maps.MarkerImage("/Content/img/static/storelocator/store-marker.png")},events:{click:function(n,i,r){f(t,r.id,r.data)}}}});n("#storeSearch").submit(function(f){f.preventDefault();n("#location").val()=="";i.hide();t.gmap3({getlatlng:{address:e.val()+t.data("searchappend"),callback:function(n){n?u(t,n[0].geometry.location,parseInt(o.val()),r.stores):i.html("Address not found").fadeIn()}}})});n(".viewAllStores").on("click",function(t){t.preventDefault();n(".no-nearby-stores, .bottom-view-stores").hide();n(".listStore").show()});n("#addressInput").val()!=""?n("#storeSearch").trigger("submit"):navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(t){var i=t.coords.latitude+","+t.coords.longitude;n("#addressInput").val("Getting rough location");geocoder=new google.maps.Geocoder;geocoder.geocode({address:i},function(t,i){i==google.maps.GeocoderStatus.OK&&(n("#addressInput").val(t[0].formatted_address),n("#storeSearch").trigger("submit"))})},function(){})}function u(t,i,r,u){console.log("searchLocation");t.gmap3({clear:{id:["mapUserLocation","mapUserRadius"]}});t.gmap3({marker:{id:"mapUserLocation",latLng:i},circle:{id:"mapUserRadius",options:{center:i,radius:r*1609.344,fillColor:"#008BB2",strokeColor:"#005BB7"},callback:function(){var i=n(this).gmap3("get"),r=t.gmap3({get:{id:"mapUserRadius"}});i.fitBounds(r.getBounds())}},map:{options:{center:i}}});o(u,i,r)}function f(t,i,r){var f=t.gmap3({get:{id:i}}),o=n("#"+i),u=n("#mapInfowindowTemplate");n(".storeIcon",u).hide();r.isHire=="True"&&n(".storeIsHire",u).show();r.isRetail=="True"&&n(".storeIsRetail",u).show();r.isBespoke=="True"&&n(".storeIsBespoke",u).show();r.isOutlet=="True"&&n(".storeIsOutlet",u).show();r.isCollect=="True"&&n(".storeIsCollect",u).show();r.isReturn=="True"&&n(".storeIsReturn",u).show();r.isSTG=="True"&&n(".storeIsSTG",u).show();r.isSTGHire=="True"&&n(".storeIsSTGHire",u).show();e.call(["327","681","682","202","674","279","035","047","088","091","169","247","260","261","293","662","669","010","243","038","201","243","683","276"],r.storeNumber)&&n(".storeIsTailorMe",u).show();u=u.html().replace("{{storeName}}",r.name).replace("{{storeLine1}}",r.line1).replace("{{storeCounty}}",r.county).replace("{{storePostcode}}",r.postcode).replace("{{storeOpening}}",r.opening).replace("{{storeTown}}",r.town).replace("{{storeTelephone}}",r.telephone).replace("{{storePage}}",r.pageLink).replace("{{storeDirections}}",r.directionsLink);r.distance=0;u=r.distance!=0&&r.distance!=99999?u.replace("{{storeDistance}}","<p>Distance: "+r.distance.toFixed(2)+" miles<\/p>"):u.replace("{{storeDistance}}","");t.gmap3({clear:"infowindow"},{infowindow:{latLng:f.position,options:{content:u}}})}function e(n){var t=n!==n,i;return i=t||typeof Array.prototype.indexOf!="function"?function(n){for(var i=-1,u=-1,r,i=0;i<this.length;i++)if(r=this[i],t&&r!==r||r===n){u=i;break}return u}:Array.prototype.indexOf,i.call(this,n)>-1}function o(i,r,u){var f,e,o;r[0]!==undefined?(f=r[0],e=r[1]):(f=r.lat()||r.$a||r.Ya,e=r.lng()||r.ab||r.Za);o=n(".listStore");o.hide();n(".no-nearby-stores, .bottom-view-stores").hide();n.each(i,function(t){var o=(i[t].lat-f)*Math.PI/180,s=(i[t].lng-e)*Math.PI/180,h=Math.sin(o/2)*Math.sin(o/2)+Math.cos(f*Math.PI/180)*Math.cos(i[t].lat*Math.PI/180)*Math.sin(s/2)*Math.sin(s/2),c=2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),r=6371*c;r<=u*1.609344?(i[t].distance=r,console.log("Close by"),console.log(i[t]),console.log("#distance"+i[t].id),console.log(n("#distance"+i[t].id)),n("#distance"+i[t].id).val(r),n(".distance-"+i[t].id).text(parseFloat(r).toFixed(2)),n("#"+i[t].id).fadeIn(200)):n("#distance"+i[t].id).val(99999)});console.log("Nested sortings plx");n(".nearby-stores").removeClass("hidden");t.sortUsingNestedText(n(".nearby-stores .panel-body"),".listStore","input.sortby");n(".listStore:visible").length<=0?n(".no-nearby-stores").fadeIn(150):n(".bottom-view-stores").fadeIn(150)}function s(t){var i=[];return n(t).each(function(t,r){var u=n(r);i.push({id:n(u).attr("id"),lat:u.data("latitude"),lng:u.data("longitude"),data:{name:n("h3",u).text(),telephone:n(".storeTelephone",u).text(),line1:n(".storeLine1",u).text(),town:n(".storeTown",u).text(),county:n(".storeCounty",u).text(),postcode:n(".storePostcode",u).text(),opening:n(".storeOpening",u).text(),isHire:n(".isHire",u).text(),isRetail:n(".isRetail",u).text(),isBespoke:n(".isBespoke",u).text(),isOutlet:n(".isOutlet",u).text(),isCollect:n(".isCollect",u).text(),isReturn:n(".isReturn",u).text(),isSTG:n(".isSTG",u).text(),isSTGHire:n(".isSTGHire",u).text(),distance:n(".sortby",u).val(),storeNumber:n(".storeNumber",u).text(),element:u,pageLink:n(".store-page-link",u).attr("href"),directionsLink:n(".store-directions-link",u).attr("href")}})}),{stores:i}}function h(){n(".js-toggle-appointment").on("click",function(t){t.preventDefault();n(".store-page__booking-bug").toggleClass("active")})}var n=n,t={};return t.init=function(){i();console.log("Store Locator Page: Enter");r();h();console.log("here");n("#map").length&&t.initMap()},t.exit=function(){console.log("Store Locator Page: Exit")},t.sortUsingNestedText=function(t,i,r){var u=t.children(i).sort(function(t,i){var u=parseInt(n(r,t).val()),f=parseInt(n(r,i).val());return u<f?-1:u>f?1:0});t.append(u)},t.initMap=function(){var i,r=n("#map").data("lat"),u=n("#map").data("lng"),o=n("#map").data("store"),t;console.log("lat"+r+"lng"+u);t={lat:r,lng:u};i=new google.maps.Map(document.getElementById("map"),{center:t,zoom:16});var f=new google.maps.MarkerImage("/Content/img/static/storelocator/store-marker.png",new google.maps.Size(50,50),new google.maps.Point(0,0),new google.maps.Point(24,45)),e=new google.maps.MarkerImage("/Content/img/static/storelocator/store-marker-shadow.png",new google.maps.Size(70,50),new google.maps.Point(0,0),new google.maps.Point(34,46)),s=new google.maps.Marker({position:t,map:i,animation:google.maps.Animation.DROP,title:"store",icon:f,shadow:e})},t})