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.694244", "139.182753");
createMarker(map_canvas, markerPos0, "
大石歯科医院五泉市村松甲2437-3
TEL 0250-58-8228
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.694244", "139.182753"));
cnt = cnt+1;
var markerPos1 = new google.maps.LatLng("37.7471909", "139.1813954");
createMarker(map_canvas, markerPos1, "加藤歯科医院五泉市旭町8-33
TEL 0250-43-0398
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.7471909", "139.1813954"));
cnt = cnt+1;
var markerPos2 = new google.maps.LatLng("37.741036", "139.181076");
createMarker(map_canvas, markerPos2, "小林歯科医院五泉市東本町2-5-4
TEL 0250-42-4362
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.741036", "139.181076"));
cnt = cnt+1;
var markerPos3 = new google.maps.LatLng("37.692978", "139.180198");
createMarker(map_canvas, markerPos3, "佐藤歯科医院五泉市村松乙633
TEL 0250-58-6251
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.692978", "139.180198"));
cnt = cnt+1;
var markerPos4 = new google.maps.LatLng("37.735101", "139.181707");
createMarker(map_canvas, markerPos4, "浅井歯科医院五泉市駅前2-6-10
TEL 0250-43-0170
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.735101", "139.181707"));
cnt = cnt+1;
var markerPos5 = new google.maps.LatLng("37.733765", "139.184032");
createMarker(map_canvas, markerPos5, "金丸歯科医院五泉市駅前2-8-14
TEL 0250-43-3870
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.733765", "139.184032"));
cnt = cnt+1;
var markerPos6 = new google.maps.LatLng("37.691219", "139.17474");
createMarker(map_canvas, markerPos6, "菅家歯科医院五泉市村松乙282-1
TEL 0250-58-7133
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.691219", "139.17474"));
cnt = cnt+1;
var markerPos7 = new google.maps.LatLng("37.694316", "139.18455");
createMarker(map_canvas, markerPos7, "鈴木歯科医院五泉市村松甲2583-1
TEL 0250-58-2822
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.694316", "139.18455"));
cnt = cnt+1;
var markerPos8 = new google.maps.LatLng("37.741803", "139.171682");
createMarker(map_canvas, markerPos8, "笹川歯科医院五泉市泉町1-4-12
TEL 0250-43-5109
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.741803", "139.171682"));
cnt = cnt+1;
var markerPos9 = new google.maps.LatLng("37.689622", "139.175343");
createMarker(map_canvas, markerPos9, "岡村歯科医院五泉市村松甲1854-丙
TEL 0250-58-6008
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.689622", "139.175343"));
cnt = cnt+1;
var markerPos10 = new google.maps.LatLng("37.737731", "139.180743");
createMarker(map_canvas, markerPos10, "関川歯科医院五泉市吉沢2-1-3
TEL 0250-42-2622
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.737731", "139.180743"));
cnt = cnt+1;
var markerPos11 = new google.maps.LatLng("37.74801", "139.174563");
createMarker(map_canvas, markerPos11, "長谷川歯科医院五泉市伊勢の川4-13
TEL 0250-43-5800
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.74801", "139.174563"));
cnt = cnt+1;
var markerPos12 = new google.maps.LatLng("37.740275", "139.175688");
createMarker(map_canvas, markerPos12, "亀嶋歯科医院五泉市本町2-3-30
TEL 0250-42-3042
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.740275", "139.175688"));
cnt = cnt+1;
var markerPos13 = new google.maps.LatLng("37.740775", "139.182054");
createMarker(map_canvas, markerPos13, "河辺歯科医院五泉市東本町2-8-44
TEL 0250-42-2425
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.740775", "139.182054"));
cnt = cnt+1;
var markerPos14 = new google.maps.LatLng("37.724971", "139.177041");
createMarker(map_canvas, markerPos14, "武田歯科クリニック五泉市木越1998-1
TEL 0250-41-0313
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.724971", "139.177041"));
cnt = cnt+1;
var markerPos15 = new google.maps.LatLng("37.692466", "139.17794");
createMarker(map_canvas, markerPos15, "いいはま歯科クリニック五泉市村松甲2190-1
TEL 0250-58-1182
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.692466", "139.17794"));
cnt = cnt+1;
var markerPos16 = new google.maps.LatLng("37.736026", "139.177099");
createMarker(map_canvas, markerPos16, "はらだ歯科医院五泉市本町1-9-7
TEL 0250-42-0163
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.736026", "139.177099"));
cnt = cnt+1;
var markerPos17 = new google.maps.LatLng("37.75195282", "139.1789997");
createMarker(map_canvas, markerPos17, "大歯科医院五泉市三本木早出3033
TEL 0250-47-5017
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.75195282", "139.1789997"));
cnt = cnt+1;
var markerPos18 = new google.maps.LatLng("37.731393", "139.176632");
createMarker(map_canvas, markerPos18, "わたなべ歯科クリニック五泉市南本町2丁目3-12
TEL 0250-42-1366
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.731393", "139.176632"));
cnt = cnt+1;
var markerPos19 = new google.maps.LatLng("37.7361091", "139.1902504");
createMarker(map_canvas, markerPos19, "あこみ歯科クリニック五泉市赤海2-156-4
TEL 0250-41-1631
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.7361091", "139.1902504"));
cnt = cnt+1;
var markerPos20 = new google.maps.LatLng("37.73074716", "139.1773992");
createMarker(map_canvas, markerPos20, "五十嵐整形外科・歯科五泉市南本町3-948-1
TEL 0250-43-3000
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.73074716", "139.1773992"));
if (cnt > 0) {
if (cnt == 1) {
map_canvas.setCenter(new google.maps.LatLng(37.73074716, 139.1773992));
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;