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.6950219,135.78963739999995), //緯度経度
content: '本店
'+//店名
'奈良市二条町1丁目3番17号
'//住所
+'電話:0742-33-0418'
});
var myMap = new google.maps.Map(document.getElementById('map'), {
zoom: 15,//地図縮尺
center: new google.maps.LatLng(34.6950219,135.78963739999995),//地図の中心点
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);
}