function attachMessage(marker, msg) {
google.maps.event.addListener(marker, 'click', function(event) {
new google.maps.InfoWindow({
content: msg
}).open(marker.getMap(), marker);
});
}
// 位置情報と表示データの組み合わせ
var data = new Array();//マーカー位置の緯度経度
data.push({position: new google.maps.LatLng(34.6809376,135.82748719999995), //緯度経度
content: '本店
'+//店名
'奈良市椿井町51
'//住所
+'電話:0742-22-0092'
});
data.push({position: new google.maps.LatLng(34.6829898,135.82830709999996), //緯度経度
content: 'アルテ館店
'+//店名
'奈良市小西町5 アルテ館1F
'//住所
+'電話:0742-27-6944'
});
var myMap = new google.maps.Map(document.getElementById('map'), {
zoom: 15,//地図縮尺
center: new google.maps.LatLng(34.6809376,135.82748719999995),//地図の中心点
scrollwheel: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
for (i = 0; i < data.length; i++) {
var myMarker = new google.maps.Marker({
position: data[i].position,
map: myMap
});
attachMessage(myMarker, data[i].content);
}