var currentInfoWindow = null; //最後に開いた情報ウィンドウを記憶 var contentStr = null; var stationList = [ {"latlng":[35.153424500000000, 136.890250100000000], name:"喜多の湯", shopImg:"https://www.refle.info/salonImg/MzYwMUAwQGJiZmUyYzMzNWI4NDVhNDEwYTU3NDhhYzAyNTZjMWU0QDkwQDQyMA%3D%3D.jpeg", open:"1", icon:"/images/googlemap/open/icon_bathhouse.png", scaledSize : new google.maps.Size(30, 34.5), manage:"25", genreName:"スーパー銭湯", url:"/shop/sannou-kitanoyu/", shopName:"喜多の湯", shopTel:"052-331-4126", reserve:"", time:"10:00~翌1:00/土日祝9:00~翌2:00(最終受付24:00/土日祝最終受付翌1:00)", closed:"不定休", mapDisable:"0" }, {"latlng":[35.151695000000000, 136.908467999999970], name:"アーバンクア", shopImg:"https://www.refle.info/salonImg/MTQwOUAwQDY2YzJmZTZmZDY4NTM0ZTk1ZWM2NWJkNGI4Mzg3MWQyQDkwQDQyMA%3D%3D.jpeg", open:"1", icon:"/images/googlemap/open/icon_bathhouse.png", scaledSize : new google.maps.Size(30, 34.5), manage:"25", genreName:"スーパー銭湯", url:"/shop/urban-quar/", shopName:"アーバンクア", shopTel:"052-324-0261", reserve:"", time:"9:00~翌1:30(最終受付:営業終了時間の30分前/祝前日翌2:00まで営業)", closed:"年中無休", mapDisable:"0" }]; function createMarker(map, i) { //マーカーを作成 station = stationList[i]; latlng = new google.maps.LatLng(station.latlng[0], station.latlng[1]); title = station.name; genreName = station.genreName; manage = station.manage; if(station.url){ imgurl = ''+station.shopName+''; url = ''+station.shopName+''; }else{ imgurl = station.shopName; url = station.shopName; } if(manage <= 5){ contentStr = '
'; contentStr += '

'+url+'

'; contentStr += '

'+genreName+'

'; contentStr += '
'; }else if(manage <= '10'){ contentStr = '
'; contentStr += '

'+url+'

'; contentStr += '
'+imgurl+'
'; contentStr += '
'; contentStr += '

'+genreName+'

'; contentStr += '

'+station.time+'

'; contentStr += '

'+station.closed+'

'; contentStr += '
'; contentStr += '
'; }else{ contentStr = '
'; contentStr += '

'+url+'

'; contentStr += '
'+imgurl+'
'; contentStr += '
'; contentStr += '

'+genreName+'

'; contentStr += '

'+station.time+'

'; contentStr += '

'+station.closed+'

'; contentStr += '
'; contentStr += '
'; } image = "image"+i; var image = { url: station.icon, scaledSize : station.scaledSize } var marker = new google.maps.Marker({ position : latlng, icon : image, map : map, title : title }); var infoWnd = new google.maps.InfoWindow({ content : contentStr }); //マーカーがクリックされたら、情報ウィンドウを表示 google.maps.event.addListener(marker, "click", function(){ if (currentInfoWindow) { currentInfoWindow.close(); } infoWnd.open(map, marker); currentInfoWindow = infoWnd; }); return marker; }