var currentInfoWindow = null; //最後に開いた情報ウィンドウを記憶 var contentStr = null; var stationList = [ {"latlng":[34.730118800000000, 135.293216100000000], name:"森温泉", shopImg:"https://www.refle.info/salonImg/QEBAOTBANDIw.jpeg", open:"2", icon:"/images/googlemap/close/icon_bathhouse_close.png", scaledSize : new google.maps.Size(20, 23), manage:"5", genreName:"スーパー銭湯", url:"/shop/morionsen/", shopName:"森温泉", shopTel:"078-411-5966", reserve:"", time:"14:00~翌0:30(最終受付0:00、《朝風呂》毎週日曜日7:00~10:30(最終受付10:00))", closed:"第1・第3火曜日(1ヶ月に2日)", mapDisable:"0" }, {"latlng":[34.714178200000000, 135.227060599999960], name:"灘温泉 水道筋店", shopImg:"https://www.refle.info/salonImg/QEBAOTBANDIw.jpeg", open:"2", icon:"/images/googlemap/close/icon_bathhouse_close.png", scaledSize : new google.maps.Size(20, 23), manage:"5", genreName:"スーパー銭湯", url:"/shop/nadaonsen-suidou/", shopName:"灘温泉 水道筋店", shopTel:"078-861-4535", reserve:"", time:"5:00~24:00(最終受付23:30)", closed:"3月・6月・9月・12月の第1木曜日", mapDisable:"0" }, {"latlng":[34.714303200000000, 135.240170900000070], name:"灘温泉 六甲道店", shopImg:"https://www.refle.info/salonImg/QEBAOTBANDIw.jpeg", open:"2", icon:"/images/googlemap/close/icon_bathhouse_close.png", scaledSize : new google.maps.Size(20, 23), manage:"5", genreName:"スーパー銭湯", url:"/shop/nadaonsen-rokko/", shopName:"灘温泉 六甲道店", shopTel:"078-854-6545", reserve:"", time:"6:00~翌1:00(最終受付0:30)", closed:"3月・6月・9月・12月の第2木曜日", mapDisable:"0" }, {"latlng":[34.706606900000000, 135.239368400000000], name:"灘浜ガーデンバーデン", shopImg:"https://www.refle.info/salonImg/QEBAOTBANDIw.jpeg", open:"1", icon:"/images/googlemap/open/icon_bathhouse.png", scaledSize : new google.maps.Size(20, 23), manage:"5", genreName:"スーパー銭湯", url:"/shop/nadahama-garden/", shopName:"灘浜ガーデンバーデン", shopTel:"078-862-2011", reserve:"", time:"10:00~21:30(最終受付20:30)", closed:"毎月第3水曜日(水曜日が祝日の場合は、その翌日)、年末年始", 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; }