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.718041", "139.036022");
createMarker(map_canvas, markerPos0, "
佐久間歯科医院新潟市南区庄瀬1073-2
TEL 025-373-3487
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.718041", "139.036022"));
cnt = cnt+1;
var markerPos1 = new google.maps.LatLng("37.72681", "138.99258");
createMarker(map_canvas, markerPos1, "月潟歯科クリニック新潟市南区月潟457-1
TEL 025-375-2685
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.72681", "138.99258"));
cnt = cnt+1;
var markerPos2 = new google.maps.LatLng("37.722335", "138.992302");
createMarker(map_canvas, markerPos2, "滝澤歯科医院新潟市南区月潟229-1
TEL 025-375-1180
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.722335", "138.992302"));
cnt = cnt+1;
var markerPos3 = new google.maps.LatLng("37.759332", "139.01307");
createMarker(map_canvas, markerPos3, "ダイセー歯科クリニック新潟市南区上下諏訪木126-1
TEL 025-373-3883
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.759332", "139.01307"));
cnt = cnt+1;
var markerPos4 = new google.maps.LatLng("37.762685", "139.019374");
createMarker(map_canvas, markerPos4, "にへい歯科医院新潟市南区白根ノ内七軒635
TEL 025-372-3939
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.762685", "139.019374"));
cnt = cnt+1;
var markerPos5 = new google.maps.LatLng("37.783914", "139.051545");
createMarker(map_canvas, markerPos5, "椎名歯科医院新潟市南区臼井1378-2
TEL 025-373-3436
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.783914", "139.051545"));
cnt = cnt+1;
var markerPos6 = new google.maps.LatLng("37.77597265", "139.0164256");
createMarker(map_canvas, markerPos6, "しのはら歯科新潟市南区鰺潟441-5
TEL 025-373-6232
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.77597265", "139.0164256"));
cnt = cnt+1;
var markerPos7 = new google.maps.LatLng("37.761127", "139.017019");
createMarker(map_canvas, markerPos7, "竹内歯科新潟市南区助次右エ門組23
TEL 025-373-2005
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.761127", "139.017019"));
cnt = cnt+1;
var markerPos8 = new google.maps.LatLng("37.762915", "139.013514");
createMarker(map_canvas, markerPos8, "木暮歯科医院新潟市南区白根3094
TEL 025-372-2555
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.762915", "139.013514"));
cnt = cnt+1;
var markerPos9 = new google.maps.LatLng("37.758135", "139.018814");
createMarker(map_canvas, markerPos9, "野内歯科医院新潟市南区戸頭1399-5
TEL 025-373-0077
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.758135", "139.018814"));
cnt = cnt+1;
var markerPos10 = new google.maps.LatLng("37.824905", "139.022471");
createMarker(map_canvas, markerPos10, "いけはた歯科医院新潟市南区大通黄金2-7-1
TEL 025-362-0120
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.824905", "139.022471"));
cnt = cnt+1;
var markerPos11 = new google.maps.LatLng("37.7960247", "139.0197705");
createMarker(map_canvas, markerPos11, "すわのき歯科クリニック新潟市南区田中25
TEL 025-372-0118
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.7960247", "139.0197705"));
cnt = cnt+1;
var markerPos12 = new google.maps.LatLng("37.76349", "139.021965");
createMarker(map_canvas, markerPos12, "こせんだ歯科医院新潟市南区能登507-4
TEL 025-372-1183
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.76349", "139.021965"));
cnt = cnt+1;
var markerPos13 = new google.maps.LatLng("37.7669596", "139.0201964");
createMarker(map_canvas, markerPos13, "あたか歯科医院新潟市南区親和町6-18
TEL 025-371-1800
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.7669596", "139.0201964"));
cnt = cnt+1;
var markerPos14 = new google.maps.LatLng("37.8259271", "139.0195107");
createMarker(map_canvas, markerPos14, "大通り歯科新潟市南区大通り黄金3-1-1
TEL 025-362-6480
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.8259271", "139.0195107"));
cnt = cnt+1;
var markerPos15 = new google.maps.LatLng("37.7599965", "139.020516");
createMarker(map_canvas, markerPos15, "新潟白根総合病院新潟市南区上下諏訪木770-1
TEL 025-372-6600
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.7599965", "139.020516"));
cnt = cnt+1;
var markerPos16 = new google.maps.LatLng("37.7609018", "139.0104757");
createMarker(map_canvas, markerPos16, "たかはし歯科医院新潟市南区西白根1391-1
TEL 025-373-6355
[医院詳細]
");
bounds.extend(new google.maps.LatLng("37.7609018", "139.0104757"));
if (cnt > 0) {
if (cnt == 1) {
map_canvas.setCenter(new google.maps.LatLng(37.7609018, 139.0104757));
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;