var currentInfoWindow = null; //最後に開いた情報ウィンドウを記憶
var geocoder;
var map_canvas;
var initPos;
var map_Point_Y;
var map_Point_X;
var bounds;
function initialize() {
geocoder = new google.maps.Geocoder();
//地図初期化
initPos = new google.maps.LatLng(37.900747, 139.049799);
var myOptions = {
center : initPos,
zoom : 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map_canvas = new google.maps.Map(document.getElementById("map"), myOptions);
setMarker();
}
function setMarker() {
var bounds = new google.maps.LatLngBounds();
var sai = "0.1";
var minLat = parseFloat(map_Point_X) - parseFloat(sai);
var minLon = parseFloat(map_Point_Y) - parseFloat(sai);
var maxLat = parseFloat(map_Point_X) + parseFloat(sai);
var maxLon = parseFloat(map_Point_Y) + parseFloat(sai);
var cnt = 0;
var $tmplon = "";
var $tmplon = "";
cnt = cnt+1;
var markerPos0 = new google.maps.LatLng("37.838384", "139.228985");
createMarker(map_canvas, markerPos0, "
斎藤歯科医院阿賀野市中央町1-11-22
TEL 0250-62-2023
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.838384", "139.228985"));
cnt = cnt+1;
var markerPos1 = new google.maps.LatLng("37.833423", "139.222808");
createMarker(map_canvas, markerPos1, "猪股歯科医院阿賀野市岡山町13-37
TEL 0250-62-1222
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.833423", "139.222808"));
cnt = cnt+1;
var markerPos2 = new google.maps.LatLng("37.840614", "139.230296");
createMarker(map_canvas, markerPos2, "冨田歯科医院阿賀野市中央町1-5-1
TEL 0250-62-6480
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.840614", "139.230296"));
cnt = cnt+1;
var markerPos3 = new google.maps.LatLng("37.840883", "139.227305");
createMarker(map_canvas, markerPos3, "アイザワ歯科医院阿賀野市北本町4-5
TEL 0250-62-1224
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.840883", "139.227305"));
cnt = cnt+1;
var markerPos4 = new google.maps.LatLng("37.840572", "139.187457");
createMarker(map_canvas, markerPos4, "緑岡歯科医院阿賀野市緑岡3-1
TEL 0250-67-2777
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.840572", "139.187457"));
cnt = cnt+1;
var markerPos5 = new google.maps.LatLng("37.841116", "139.214964");
createMarker(map_canvas, markerPos5, "よしだ歯科医院阿賀野市山口町1-6-8
TEL 0250-62-0139
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.841116", "139.214964"));
cnt = cnt+1;
var markerPos6 = new google.maps.LatLng("37.784418", "139.230323");
createMarker(map_canvas, markerPos6, "山浦歯科医院阿賀野市寺社甲160-3
TEL 0250-68-5763
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.784418", "139.230323"));
cnt = cnt+1;
var markerPos7 = new google.maps.LatLng("37.863131", "139.248294");
createMarker(map_canvas, markerPos7, "こばやし歯科医院阿賀野市榎船渡111
TEL 0250-63-2626
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.863131", "139.248294"));
cnt = cnt+1;
var markerPos8 = new google.maps.LatLng("37.839559", "139.221722");
createMarker(map_canvas, markerPos8, "にらさわ歯科医院阿賀野市中央町2-13-14
TEL 0250-63-2888
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.839559", "139.221722"));
cnt = cnt+1;
var markerPos9 = new google.maps.LatLng("37.772892", "139.234561");
createMarker(map_canvas, markerPos9, "さの歯科クリニック阿賀野市保田1768-1
TEL 0250-68-1110
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.772892", "139.234561"));
cnt = cnt+1;
var markerPos10 = new google.maps.LatLng("37.840476", "139.184936");
createMarker(map_canvas, markerPos10, "京ヶ瀬歯科医院阿賀野市姥ヶ橋998-1
TEL 0250-67-2611
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.840476", "139.184936"));
cnt = cnt+1;
var markerPos11 = new google.maps.LatLng("37.828784", "139.218534");
createMarker(map_canvas, markerPos11, "かねこ歯科医院阿賀野市百津町4-29
TEL 0250-63-9200
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.828784", "139.218534"));
cnt = cnt+1;
var markerPos12 = new google.maps.LatLng("37.8351703", "139.2281495");
createMarker(map_canvas, markerPos12, "たかはし歯科クリニック阿賀野市中島町7-4
TEL 0250-25-7581
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.8351703", "139.2281495"));
cnt = cnt+1;
var markerPos13 = new google.maps.LatLng("37.8327178", "139.2211975");
createMarker(map_canvas, markerPos13, "あがの市民病院阿賀野市岡山町13-23
TEL 0250-62-2780
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.8327178", "139.2211975"));
if (cnt > 0) {
if (cnt == 1) {
map_canvas.setCenter(new google.maps.LatLng(37.8327178, 139.2211975));
map_canvas.setZoom(15);
} else {
map_canvas.fitBounds(bounds);
}
if(document.getElementById("search_cnt") != null) {
document.getElementById("search_cnt").innerHTML = cnt + "件該当しました。";
}
} else {
if(document.getElementById("search_cnt") != null) {
document.getElementById("search_cnt").innerHTML = "該当する情報がありません。";
}
}
}
function createMarker(map, latlng, text) {
var infoWndOpts = {
content : text
};
var infoWnd = new google.maps.InfoWindow(infoWndOpts);
var markerOpts = {
position : latlng,
map : map
};
var marker = new google.maps.Marker(markerOpts);
google.maps.event.addListener(marker, "click", function(){
//先に開いた情報ウィンドウがあれば、closeする
if (currentInfoWindow) {
currentInfoWindow.close();
}
//情報ウィンドウを開く
infoWnd.open(map, marker);
currentInfoWindow = infoWnd;
});
return marker;
}
function getLatLng(address) {
if (geocoder) {
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var bounds = new google.maps.LatLngBounds();
for (var i in results) {
if (results[i].geometry) {
// 緯度経度を取得
latlng = results[i].geometry.location;
// 緯度
map_Point_Y = latlng.lat();
// 経度
map_Point_X = latlng.lng();
map_canvas.setCenter(latlng);
}
}
setMarker();
}
});
}
}
window.onload = initialize;