var map = null;
var geocoder = null;
var marker2 = null;

function createMarker(point, html, icon){
	var marker = new GMarker(point, icon);
	GEvent.addListener(marker, "mouseover", function() {
		marker.openInfoWindowHtml(html);
		});
	return marker;
	}

function load() {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GScaleControl());
		map.addControl(new GMapTypeControl());
		map.enableContinuousZoom();
		map.enableDoubleClickZoom();

	// GClientGeocoderを初期化
	geocoder = new GClientGeocoder();

var center = new GLatLng(36.456636, 139.117126);
map.setCenter(center, 9);

	icon = new GIcon();
	icon.image = '../img/marker.gif';
	icon.iconSize = new GSize( 25, 33 );	// 画像の大きさ
	icon.shadow = '../img/marker_shadow.png';
	icon.shadowSize = new GSize( 45, 29 );	// 影画像の大きさ
	icon.iconAnchor = new GPoint( 12, 32 );	// 画像の「基準点」
	icon.infoWindowAnchor = new GPoint( 12, 32 );	// 情報ウィンドウの基準点
var html; 
var point;


	point = new GLatLng(36.38437,139.304954);
	html = '<p class="gMapCom">（株）藤生建設</p><p class="gMapAdd">みどり市笠懸町阿左美９８０</p><p class="gMapTel">0277（76）2357</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.299524,139.199487);
	html = '<p class="gMapCom"><a href="http://www.choken.jp/" target="_blank">（株）長建産業</a></p><p class="gMapAdd">伊勢崎市ひろせ町４１０４-９</p><p class="gMapTel">0270（25）4600</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.341311,139.211912);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/zen-kenchiku/" target="_blank">（有）膳建築</a></p><p class="gMapAdd">伊勢崎市上植木本町２５０４</p><p class="gMapTel">0270（25）0611</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.408089,139.249129);
	html = '<p class="gMapCom"><a href="http://www.kusadokoro.co.jp/" target="_blank">草処建設（株）</a></p><p class="gMapAdd">桐生市新里町新川１７１</p><p class="gMapTel">0277（74）1682</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.573433,138.830877);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/jomo-seizai/" target="_blank">上毛製材（株）</a></p><p class="gMapAdd">吾妻郡東吾妻町大字原町４６０-２</p><p class="gMapTel">0279（68）2724</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.51739,138.989321);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/aisaki/" target="_blank">（株）相崎</a></p><p class="gMapAdd">渋川市金井１７６３</p><p class="gMapTel">0279（22）2093</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.513943,139.003644);
	html = '<p class="gMapCom"><a href="http://www.fukushima-s.com/" target="_blank">（株）福島商店</a></p><p class="gMapAdd">渋川市金井４４３-３</p><p class="gMapTel">0279（22）2948</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.469523,139.011034);
	html = '<p class="gMapCom"><a href="http://www.yamada-sc.com/" target="_blank">山田工務店（株）</a></p><p class="gMapAdd">渋川市八木原１００-１</p><p class="gMapTel">0279（24）2527</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.692197,139.058794);
	html = '<p class="gMapCom"><a href="http://www.saito-ringyo.jp/" target="_blank">（株）斉藤林業</a></p><p class="gMapAdd">沼田市発知新田町７５９-１</p><p class="gMapTel">0278（50）4118</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.38475,139.095456);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/hirose-rinsan/" target="_blank">広瀬林産工業（株）</a></p><p class="gMapAdd">前橋市西片貝町４-１７-１７</p><p class="gMapTel">027（224）2834</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.37386,139.105243);
	html = '<p class="gMapCom"><a href="http://www.hirakata-m.co.jp/" target="_blank">平方木材（株）</a></p><p class="gMapAdd">前橋市天川大島町１２４８</p><p class="gMapTel">027（261）0216</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.359789,139.177537);
	html = '<p class="gMapCom"><a href="http://www.fujikohei.jp/" target="_blank">富士工営（株）</a></p><p class="gMapAdd">前橋市飯土井町１６８-４</p><p class="gMapTel">027（268）3484</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.383449,139.070053);
	html = '<p class="gMapCom"><a href="http://www.tohgoku.or.jp/~hide-y/" target="_blank">（有）大寛建設</a></p><p class="gMapAdd">前橋市表町１-２４-１２</p><p class="gMapTel">027（221）7284</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.409731,139.136218);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/maebashi-meibokuten/" target="_blank">（株）前橋銘木店</a></p><p class="gMapAdd">前橋市堀越町２５１-１</p><p class="gMapTel">027（269）0441</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.437215,138.996573);
	html = '<p class="gMapCom"><a href="http://www.dai-iti.com/" target="_blank">大一建設（株）</a></p><p class="gMapAdd">北群馬郡吉岡町南下２５３</p><p class="gMapTel">0279（54）4385</p>';
	map.addOverlay(createMarker(point, html, icon));
		
	point = new GLatLng(36.315409,139.236743);
	html = '<p class="gMapCom"><a href="http://www.yoshida-sangiyo.co.jp/" target="_blank">ヨシダ産業（株）</a></p><p class="gMapAdd">伊勢崎市日乃出町５９３－３</p><p class="gMapTel">0270（24）2555</p>';
	map.addOverlay(createMarker(point, html, icon));
		
	point = new GLatLng(36.491126,139.004164);
	html = '<p class="gMapCom"><a href="http://www.yashiro-kk.com/" target="_blank">八城建設（株）</a></p><p class="gMapAdd">渋川市渋川１６９７－１０</p><p class="gMapTel">0279（22）0099</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.378789,139.097886);
	html = '<p class="gMapCom"><a href="http://www.k-oikos.com/" target="_blank">（有）建築工房oikos</a></p><p class="gMapAdd">前橋市天川大島町１－３３－１５</p><p class="gMapTel">027（220）5035</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.257898, 139.409461);
	html = '<p class="gMapCom"><a href="http://www.maedakensetu.jp/" target="_blank">前田建設（株）</a></p><p class="gMapAdd">邑楽郡大泉町西小泉４－２２－２１</p><p class="gMapTel">0276（62）6333</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.661873,139.104733);
	html = '<p class="gMapCom"><a href="http://www.ogura-jyuken.com/" target="_blank">（有）小倉住建</a></p><p class="gMapAdd">沼田市上久屋町１３６２－２２</p><p class="gMapTel">0278（24）0577</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.231663,139.056288);
	html = '<p class="gMapCom"><a href="http://www.motoyamakensetsu.com/" target="_blank">（有）本山建設</a></p><p class="gMapAdd">藤岡市鮎川２１３-１</p><p class="gMapTel">0274（24）2330</p>';
	map.addOverlay(createMarker(point, html, icon));



	}
}


function showAddress(address) {
	if (geocoder) {
		geocoder.getLatLng(
		address,
			function(point) {
				if (!point) {
				alert(address + " not found");
				} else {
					if(marker2 != null){
					map.removeOverlay(marker2);
					}
				var icon = new GIcon();
				icon.image = "../img/aicon_map.gif";  //アイコン画
				icon.shadow = "../img/aicon_map.gif"; //影の画
				icon.iconSize = new GSize(36, 36);    //アイコンサイズ
				icon.shadowSize = new GSize(36, 36); //影のサイズ
				icon.iconAnchor = new GPoint(18, 36);
				icon.infoWindowAnchor = new GPoint(18, 0);
				var markeropts = new Object();
				markeropts.icon = icon;
				map.setCenter(point, 13);
				marker2 = new GMarker(point, icon);
				map.addOverlay(marker2);
				marker2.openInfoWindowHtml(address);
				}
			}
		);
	}
}

