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.087292", "138.608234");
createMarker(map_canvas, markerPos0, "
伊藤歯科クリニック十日町市松之山1603-2
TEL 025-596-2067
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.087292", "138.608234"));
cnt = cnt+1;
var markerPos1 = new google.maps.LatLng("37.131615", "138.751427");
createMarker(map_canvas, markerPos1, "川西歯科十日町市春日102
TEL 025-757-1777
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.131615", "138.751427"));
cnt = cnt+1;
var markerPos2 = new google.maps.LatLng("37.13353645", "138.7578499");
createMarker(map_canvas, markerPos2, "田村歯科医院十日町市泉22
TEL 025-757-8920
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.13353645", "138.7578499"));
cnt = cnt+1;
var markerPos3 = new google.maps.LatLng("37.13184714", "138.758837");
createMarker(map_canvas, markerPos3, "中林歯科医院十日町市子259-7
TEL 025-757-2335
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.13184714", "138.758837"));
cnt = cnt+1;
var markerPos4 = new google.maps.LatLng("37.195744", "138.778758");
createMarker(map_canvas, markerPos4, "中町歯科医院十日町市下条3-482
TEL 025-755-2019
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.195744", "138.778758"));
cnt = cnt+1;
var markerPos5 = new google.maps.LatLng("37.1331787", "138.7604959");
createMarker(map_canvas, markerPos5, "蕪木歯科医院十日町市本町3-2-3
TEL 025-752-5380
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.1331787", "138.7604959"));
cnt = cnt+1;
var markerPos6 = new google.maps.LatLng("37.160777", "138.737719");
createMarker(map_canvas, markerPos6, "田中歯科医院十日町市水口沢66
TEL 025-768-4329
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.160777", "138.737719"));
cnt = cnt+1;
var markerPos7 = new google.maps.LatLng("37.1346824", "138.7609426");
createMarker(map_canvas, markerPos7, "中央歯科医院十日町市本町4-62
TEL 025-752-2797
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.1346824", "138.7609426"));
cnt = cnt+1;
var markerPos8 = new google.maps.LatLng("37.13462272", "138.7578338");
createMarker(map_canvas, markerPos8, "西野歯科医院十日町市丑238-1
TEL 025-752-4346
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.13462272", "138.7578338"));
cnt = cnt+1;
var markerPos9 = new google.maps.LatLng("37.149018", "138.763959");
createMarker(map_canvas, markerPos9, "二瓶歯科医院十日町市四日町 1462
TEL 025-752-4888
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.149018", "138.763959"));
cnt = cnt+1;
var markerPos10 = new google.maps.LatLng("37.128693", "138.750239");
createMarker(map_canvas, markerPos10, "鈴木歯科医院十日町市錦町1-48-1
TEL 025-757-2263
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.128693", "138.750239"));
cnt = cnt+1;
var markerPos11 = new google.maps.LatLng("37.127551", "138.753174");
createMarker(map_canvas, markerPos11, "ホープ歯科クリニック十日町市寿町2-6-25
TEL 025-752-0525
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.127551", "138.753174"));
cnt = cnt+1;
var markerPos12 = new google.maps.LatLng("37.13406675", "138.7640029");
createMarker(map_canvas, markerPos12, "和歯科医院十日町市卯123
TEL 025-752-5622
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.13406675", "138.7640029"));
cnt = cnt+1;
var markerPos13 = new google.maps.LatLng("37.096316", "138.731493");
createMarker(map_canvas, markerPos13, "水沢歯科医院十日町市馬場丙1507
TEL 025-758-3358
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.096316", "138.731493"));
cnt = cnt+1;
var markerPos14 = new google.maps.LatLng("37.0513954", "138.6966004");
createMarker(map_canvas, markerPos14, "ひまわり歯科クリニック十日町市山崎1415
TEL 025-763-2020
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.0513954", "138.6966004"));
cnt = cnt+1;
var markerPos15 = new google.maps.LatLng("37.1312089", "138.7524634");
createMarker(map_canvas, markerPos15, "新潟県立十日町病院十日町市高田町3丁目南32-9
TEL 025-757-5566
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.1312089", "138.7524634"));
cnt = cnt+1;
var markerPos16 = new google.maps.LatLng("37.1620894", "138.7723178");
createMarker(map_canvas, markerPos16, "中条歯科クリニック十日町市中条甲826-9
TEL 025-761-7205
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.1620894", "138.7723178"));
if (cnt > 0) {
if (cnt == 1) {
map_canvas.setCenter(new google.maps.LatLng(37.1620894, 138.7723178));
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;