/*
MIT License
*/
window.gMapsCallback=function(){$(window).trigger("gMapsCallback")};
(function(g,u,p,H){function q(a,b){var c={lat:"",lng:""},d=[],e=/^[+-]?\d+(\.\d+)?$/;if("string"===typeof a||Array.isArray(a))if(d=Array.isArray(a)?a:a.toString().replace(/\s+/,"").split(","),2===d.length)e.test(d[0])&&e.test(d[1])&&(c.lat=d[0],c.lng=d[1]);else return a;else if("object"===typeof a){if("function"===typeof a.lat)return a;a.hasOwnProperty("x")&&a.hasOwnProperty("y")?(c.lat=a.x,c.lng=a.y):a.hasOwnProperty("lat")&&a.hasOwnProperty("lng")&&(c.lat=a.lat,c.lng=a.lng)}return!0===b?new google.maps.LatLng(c.lat,
c.lng):c}function x(a){var b=a.hasOwnProperty("css")?a.css.toString():"";this.setValues(a);this.span=g("").css({position:"relative",left:"-50%",top:"0","white-space":"nowrap"}).addClass(b);this.div=g("
").css({position:"absolute",display:"none"});this.span.appendTo(this.div)}function z(a,b){var c=this,d=g.extend({},G,b);c.map=null;c._markers=[];c._markersCluster=[];c._clusters={};c._bounds={};c._labels=[];c._polylines=[];c._polygons=[];c._circles=[];c._kmls=[];c._directions=[];c._directionsMarkers=
[];c._places=[];c.container=a;c.options=d;c.googleMapOptions={};c.interval=parseInt(c.options.interval,10)||200;g(u).on("gMapsCallback",function(){c.init()});g(this.container).html(d.loading);c.init()}var C=!1,D=!1,E=!1,y={language:"zh-TW",callback:"gMapsCallback",api:"https://maps.googleapis.com/maps/api/js",clusterer:"https://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/src/markerclusterer_packed.js",withLabel:"https://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerwithlabel/src/markerwithlabel_packed.js"},
G={autoLocation:!1,center:[24,121],infoWindowAutoClose:!0,interval:200,loading:"\u8b80\u53d6\u4e2d…",notFound:"\u627e\u4e0d\u5230\u67e5\u8a62\u7684\u5730\u9ede",zoom:8},A={},F,A={greyscale:[{featureType:"all",stylers:[{saturation:-100},{gamma:.5}]}]};z.prototype={VERSION:"3.3.12",formatSize:function(a){return Array.isArray(a)&&2===a.length?new google.maps.Size(a[0],a[1]):a},formatPoint:function(a){return Array.isArray(a)&&2===a.length?new google.maps.Point(a[0],a[1]):a},overlay:function(){var a=
this.map,b=this.options;try{this.adsense(a,b),this.kml(a,b),this.directionService(a,b),this.placeMarkers(a,b),this.drawPolyline(a,b),this.drawPolygon(a,b),this.drawCircle(a,b),this.streetView(a,b),this.places(a,b),this.geoLocation(a,b)}catch(c){console.error(c)}},bindEvents:function(a,b){var c=this,d={};switch(typeof b){case "function":google.maps.event.clearListeners(a,"click");google.maps.event.addListener(a,"click",b);break;case "object":for(d in b)"function"===typeof b[d]?"created"===d?b[d].call(a):
(google.maps.event.clearListeners(a,d),google.maps.event.addListener(a,d,b[d])):b[d].hasOwnProperty("func")&&"function"===typeof b[d].func?b[d].hasOwnProperty("once")&&!0===b[d].once?google.maps.event.addListenerOnce(a,d,b[d].func):(google.maps.event.clearListeners(a,d),google.maps.event.addListener(a,d,b[d].func)):"function"===typeof b[d]&&(google.maps.event.clearListeners(a,d),google.maps.event.addListener(a,d,b[d]))}a.hasOwnProperty("infoWindow")&&(google.maps.event.clearListeners(a,"click"),google.maps.event.addListener(a,
"click",function(){var b=0,d={};if(c.options.hasOwnProperty("infoWindowAutoClose")&&!0===c.options.infoWindowAutoClose)for(b=0;bm&&d.push({location:k.getAt(m),stopover:!1});c.hasOwnProperty("event")&&this.bindEvents(e,c.event);c.hasOwnProperty("snap")&&!0===c.snap?(h=new google.maps.DirectionsService,h.route({origin:k.getAt(0),waypoints:d,destination:k.getAt(k.length-1),travelMode:google.maps.DirectionsTravelMode.DRIVING},v)):(e.setPath(k),google.maps.hasOwnProperty("geometry")&&google.maps.geometry.hasOwnProperty("spherical")&&"function"===typeof google.maps.geometry.spherical.computeDistanceBetween&&
(f=google.maps.geometry.spherical.computeDistanceBetween(k.getAt(0),k.getAt(k.length-1)),"function"===typeof c.getDistance&&c.getDistance.call(this,f)));e.setMap(a)}},drawPolygon:function(a,b){var c={},d={},c=[],e=0,d=0,f={},f={};if(b.hasOwnProperty("polygon")&&Array.isArray(b.polygon))for(e=0;e',""];b.length===a.options.marker.length?(clearInterval(F),b.forEach(function(a){"undefined"!==typeof a.infoWindow&&a.infoWindow.close();f.push('")}),f.push(""),d.on("change.tinyMap","select",function(){var b=
g(this);a.close("marker");this.value.length&&a.get({marker:[this.value]},function(d){var e={};d.marker.length&&"undefined"!==d.marker[0]&&(e=d.marker[0],!0===c.infoWindow&&"undefined"!==typeof e.infoWindow&&"function"===typeof e.infoWindow.open&&e.infoWindow.open(a.map,e),!0===c.panTo&&a.map.panTo(e.getPosition()),"function"===typeof c.onChange&&c.onChange.call(b,e))})}).html(f.join("")),"string"===typeof c.css&&d.find("select").addClass(c.css)):F=setInterval(function(){a.markerControl()},1E3)}))},
placeMarkers:function(a,b,c){var d=this,e={},f={maxZoom:null,gridSize:60},h=Array.isArray(b.marker)?b.marker:[];d.options.hasOwnProperty("markerCluster")&&"function"===typeof MarkerClusterer&&(f=g.extend({},f,b.markerCluster),d._clusters=new MarkerClusterer(a,[],f),f.hasOwnProperty("event")&&d.bindEvents(d._clusters,f.event));h.forEach(function(f){var h=q(f.addr,!0),n=d.markerIcon(f),m=!0,v=!1,t={},w={},B="undefined"!==typeof f.id?f.id:f.addr.toString().replace(/\s/g,""),l={id:B,map:a,animation:null},
l=g.extend({},l,f);"modify"===c&&B&&d.get({marker:[B]},function(a){!Array.isArray(a.marker)||!a.marker.length||f.hasOwnProperty("forceInsert")&&!0===f.forceInsert||(f=g.extend(a.marker[0],f),"function"===typeof d._clusters.removeMarker&&d._clusters.removeMarker(a.marker[0]),m=!1,v=!0)});f.hasOwnProperty("title")&&(l.title=f.title.toString().replace(/<([^>]+)>/g,""));g.isEmptyObject(n)||(l.icon=n);f.hasOwnProperty("animation")&&"string"===typeof f.animation&&(l.animation=google.maps.Animation[f.animation.toUpperCase()]);
"string"===typeof h?(e=new google.maps.Geocoder,e.geocode({address:h},function(e,h){h===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?setTimeout(function(){d.placeMarkers(a,b,c)},d.interval):h===google.maps.GeocoderStatus.OK&&(!m&&v?("function"===typeof f.setPosition&&(f.setPosition(e[0].geometry.location),l.hasOwnProperty("title")&&f.setTitle(l.title),l.hasOwnProperty("icon")&&f.setIcon(l.icon)),w=f):(l.position=e[0].geometry.location,t=b.hasOwnProperty("markerWithLabel")&&!0===b.markerWithLabel?"function"===
typeof MarkerWithLabel?new MarkerWithLabel(l):new google.maps.Marker(l):new google.maps.Marker(l),d._markers.push(t),w=t),d.processMarker(a,b,w,c))})):(!m&&v?("function"===typeof f.setPosition&&(f.setPosition(h),l.hasOwnProperty("title")&&f.setTitle(l.title),l.hasOwnProperty("icon")&&f.setIcon(l.icon)),w=f):(l.position=h,t=b.hasOwnProperty("markerWithLabel")&&!0===b.markerWithLabel?"function"===typeof MarkerWithLabel?new MarkerWithLabel(l):new google.maps.Marker(l):new google.maps.Marker(l),d._markers.push(t),
w=t),d.processMarker(a,b,w,c))});d.markerControl()},directionService:function(a,b){var c=this,d=new google.maps.DirectionsService;Array.isArray(b.direction)&&b.direction.forEach(function(b){if("undefined"!==typeof b.from&&"undefined"!==typeof b.to){var f={},h=new google.maps.DirectionsRenderer,k=g.extend({},{infoWindow:new google.maps.InfoWindow,map:c.map},b),r=[],n=[],m=[];f.origin=q(b.from,!0);f.destination=q(b.to,!0);f.travelMode=b.hasOwnProperty("travel")&&google.maps.TravelMode[b.travel.toString().toUpperCase()]?
google.maps.TravelMode[b.travel.toString().toUpperCase()]:google.maps.TravelMode.DRIVING;b.hasOwnProperty("panel")&&g(b.panel).length&&(k.panel=g(b.panel).get(0));b.hasOwnProperty("requestExtra")&&b.requestExtra&&(f=g.extend({},f,b.requestExtra));b.hasOwnProperty("waypoint")&&Array.isArray(b.waypoint)&&(b.waypoint.forEach(function(a){var b={stopover:!0};"string"===typeof a||Array.isArray(a)?b.location=q(a,!0):a.hasOwnProperty("location")&&(b.location=q(a.location,!0),b.stopover=a.hasOwnProperty("stopover")?
a.stopover:!0);n.push(a.text||a.toString());a.hasOwnProperty("icon")&&m.push(a.icon.toString());r.push(b)}),f.waypoints=r);d.route(f,function(d,g){g===google.maps.DirectionsStatus.OK&&(d.routes.forEach(function(h,g){b.hasOwnProperty("renderAll")&&!0===b.renderAll&&!0===f.provideRouteAlternatives&&new google.maps.DirectionsRenderer({map:a,directions:d,routeIndex:g});var l=h.legs,r="",t="",q={},p=0;b.hasOwnProperty("fromText")&&(r=l[0].start_address=b.fromText);b.hasOwnProperty("toText")&&(1===l.length?
l[0].end_address=b.toText:l[l.length-1].end_address=b.toText,t=b.toText);b.hasOwnProperty("icon")&&(k.suppressMarkers=!0,b.icon.hasOwnProperty("from")&&"string"===typeof b.icon.from&&c.directionServiceMarker(l[0].start_location,{icon:b.icon.from,text:r},k.infoWindow,b),b.icon.hasOwnProperty("to")&&"string"===typeof b.icon.to&&c.directionServiceMarker(l[l.length-1].end_location,{icon:b.icon.to,text:t},k.infoWindow,b));for(p=1;p #style1 #DATA# ".split(" "),d=" #style1 1 1 clampedToGround #LATLNG# ".split(" "),
e="",f="",h="",k="",r="";a="";this.get("marker,polyline,polygon,circle,direction",function(a){var g="";!0===b.marker&&"undefined"!==typeof a.marker&&a.marker.forEach(function(a){g=[a.getPosition().lng(),a.getPosition().lat()].join();e+=c.join("").replace(/#NAME#/gi,"Markers").replace(/#DATA#/gi,"#LATLNG#,0.000000".replace(/#LATLNG#/gi,g))});!0===b.polyline&&"undefined"!==typeof a.polyline&&a.polyline.forEach(function(a){g="";a.getPath().getArray().forEach(function(a){g+=
[a.lng(),a.lat(),"0.000000\n"].join()});f+=c.join("").replace(/#NAME#/gi,"Polylines").replace(/#DATA#/gi,"1#LATLNG#".replace(/#LATLNG#/gi,g))});!0===b.polygon&&"undefined"!==typeof a.polygon&&a.polygon.forEach(function(a){g="";a.getPath().getArray().forEach(function(a){g+=[a.lng(),a.lat(),"0.000000\n"].join()});h+=d.join("").replace(/#NAME#/gi,"Polygons").replace(/#LATLNG#/gi,g)});!0===b.circle&&"undefined"!==typeof a.circle&&
a.circle.forEach(function(a){g="";for(var b=Math.PI/180,c=180/Math.PI,c=a.getRadius()/6378137*c,b=c/Math.cos(a.getCenter().lat()*b),e=0,f=0,h=e=0,h=0;65>h;h+=1)e=h/32*Math.PI,f=a.getCenter().lng()+b*Math.cos(e),e=a.getCenter().lat()+c*Math.sin(e),g+=[f,e,"0.000000\n"].join();k+=d.join("").replace(/#NAME#/gi,"Circles").replace(/#LATLNG#/gi,g)});!0===b.direction&&"undefined"!==typeof a.direction&&a.direction.forEach(function(a){a=a.getDirections();a.hasOwnProperty("routes")&&Array.isArray(a.routes)&&
"undefined"!==typeof a.routes[0]&&"undefined"!==typeof a.routes[0].legs&&Array.isArray(a.routes[0].legs)&&a.routes[0].legs.forEach(function(a){Array.isArray(a.steps)&&a.steps.forEach(function(a){g="";Array.isArray(a.path)&&a.path.forEach(function(a){g+=[a.lng(),a.lat(),"0.000000\n"].join()});r+=c.join("").replace(/#NAME#/gi,"Directions").replace(/#DATA#/gi,"1#LATLNG#".replace(/#LATLNG#/gi,g))})})})});a='#PLACEMARKS#'.replace(/#NAME#/gi,
"").replace(/#PLACEMARKS#/gi,e+f+h+k+r);if(!0===b.download)u.open("data:application/vnd.google-earth.kml+xml;charset=utf-8;base64,"+u.btoa(u.decodeURIComponent(u.encodeURIComponent(a))));else return a},init:function(){var a=this,b={},c={},c=g.extend({},y),d=c.api.split("?")[0],e="",b={},f={};try{delete c.api,delete c.clusterer,delete c.withLabel,c=g.param(c)}catch(h){}C||"undefined"!==typeof u.google||(b=p.createElement("script"),b.setAttribute("src",[d,c].join("?")),(p.getElementsByTagName("head")[0]||
p.documentElement).appendChild(b),C=!0,b=null);if("object"===typeof u.google){!D&&a.options.hasOwnProperty("markerCluster")&&!1!==a.options.markerCluster&&"undefined"===typeof MarkerClusterer&&(b=p.createElement("script"),b.setAttribute("src",y.clusterer),(p.getElementsByTagName("head")[0]||p.documentElement).appendChild(b),D=!0,b=null);!E&&a.options.hasOwnProperty("markerWithLabel")&&!0===a.options.markerWithLabel&&"undefined"===typeof MarkerWithLabel&&(b=p.createElement("script"),b.setAttribute("src",
y.withLabel),(p.getElementsByTagName("head")[0]||p.documentElement).appendChild(b),E=!0,b=null);a._bounds=new google.maps.LatLngBounds;x.prototype=new google.maps.OverlayView;x.prototype.onAdd=function(){var a=this;null!==a.div&&(a.div.appendTo(g(a.getPanes().overlayLayer)),a.listeners=[google.maps.event.addListener(a,"visible_changed",function(){a.draw()}),google.maps.event.addListener(a,"position_changed",function(){a.draw()}),google.maps.event.addListener(a,"visible_changed",function(){a.draw()}),
google.maps.event.addListener(a,"clickable_changed",function(){a.draw()}),google.maps.event.addListener(a,"text_changed",function(){a.draw()}),google.maps.event.addListener(a,"zindex_changed",function(){a.draw()})])};x.prototype.draw=function(){var a=this.getProjection(),b={};try{null!==this.div&&a&&((b=a.fromLatLngToDivPixel(this.get("position")))&&this.div.css({left:b.x+"px",top:b.y+"px",display:this.get("visible")?"block":"none"}),this.text&&this.span.html(this.text.toString()))}catch(c){console.error(c)}};
x.prototype.onRemove=function(){g(this.div).remove();this.div=null};for(f in a.options)a.options.hasOwnProperty(f)&&(b=a.options[f],/ControlOptions/g.test(f)&&b.hasOwnProperty("position")&&"string"===typeof b.position&&(a.options[f].position=google.maps.ControlPosition[b.position.toUpperCase()]));a.googleMapOptions=a.options;a.options.hasOwnProperty("streetView")&&(a.googleMapOptions.streetViewObj=a.options.streetView,delete a.googleMapOptions.streetView);a.googleMapOptions.center=q(a.options.center,
!0);a.options.hasOwnProperty("styles")&&("string"===typeof a.options.styles&&A.hasOwnProperty(a.options.styles)?a.googleMapOptions.styles=A[a.options.styles]:Array.isArray(a.options.styles)&&(a.googleMapOptions.styles=a.options.styles));"string"===typeof a.options.center?(c=new google.maps.Geocoder,c.geocode({address:a.options.center},function(b,c){try{c===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?setTimeout(function(){a.init()},a.interval):c===google.maps.GeocoderStatus.OK&&Array.isArray(b)?0<
b.length&&b[0].hasOwnProperty("geometry")&&(a.googleMapOptions.center=b[0].geometry.location,a.map=new google.maps.Map(a.container,a.googleMapOptions),google.maps.event.addListenerOnce(a.map,"tilesloaded",function(){a.overlay();google.maps.event.trigger(a.map,"resize")}),a.bindEvents(a.map,a.options.event)):(e=(a.options.notFound||c).toString(),a.container.innerHTML(g("").text(e).html()),console.error("Geocoder Error Code: "+c))}catch(d){console.error(d)}})):(a.map=new google.maps.Map(a.container,
a.googleMapOptions),google.maps.event.addListenerOnce(a.map,"tilesloaded",function(){a.overlay();google.maps.event.trigger(a.map,"resize")}),a.bindEvents(a.map,a.options.event))}}};g.fn.tinyMapConfigure=function(a){y=g.extend(y,a)};g.fn.tinyMap=function(a){var b={},c=[],d=arguments;return"string"===typeof a?(this.each(function(){b=g.data(this,"tinyMap");b instanceof z&&"function"===typeof b[a]&&(c=b[a].apply(b,Array.prototype.slice.call(d,1)))}),"undefined"!==typeof c?c:this):this.each(function(){g.data(this,
"tinyMap")||g.data(this,"tinyMap",new z(this,a))})}})(window.jQuery||{},window,document);