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.570622, 139.84497);
	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.537694,139.843286);
	html = '<p class="gMapCom"><a href="http://www.u-41.co.jp/" target="_blank">（株）薄井工務店</a></p><p class="gMapAdd">宇都宮市下砥上町１１９０-３</p><p class="gMapTel">028（658）4413</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.560809,139.948653);
	html = '<p class="gMapCom"><a href="http://www.watashou.com/" target="_blank">（株）渡商</a></p><p class="gMapAdd">宇都宮市下平出町２３２８-１</p><p class="gMapTel">028（661）1836</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.571257, 139.914584);
	html = '<p class="gMapCom"><a href="http://www.next-home.co.jp/" target="_blank">ネキストホーム</a></p><p class="gMapAdd">宇都宮市今泉町2995-1</p><p class="gMapTel">0120（621）758</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.488497,139.8746);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/kobayashi-mokuzaisangyo/" target="_blank">（有）小林木材産業</a></p><p class="gMapAdd">宇都宮市雀の宮５-４-１５</p><p class="gMapTel">028（653）0230</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.566714,139.946945);
	html = '<p class="gMapCom"><a href="http://shino-g.com/" target="_blank">（株）シノザキ</a></p><p class="gMapAdd">宇都宮市平出町１０９１</p><p class="gMapTel">028（664）3311</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.602906,139.856604);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/kobori-zaimokuten/" target="_blank">（有）小堀材木店</a></p><p class="gMapAdd">宇都宮市宝木本町１１６６-２</p><p class="gMapTel">028（665）0505</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.476868,139.873175);
	html = '<p class="gMapCom"><a href="http://www.abe-kou.co.jp/" target="_blank">阿部興業（株）</a></p><p class="gMapAdd">宇都宮市茂原２-１０-２４</p><p class="gMapTel">028（655）1001</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.556814,139.932019);
	html = '<p class="gMapCom"><a href="http://www.will-home.com/" target="_blank">（株）ウィルホーム</a></p><p class="gMapAdd">宇都宮市陽東６-４-５</p><p class="gMapTel">028（683）5545</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.770261,139.843179);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/noguchikenchiku/" target="_blank">（株）野口建築工業</a></p><p class="gMapAdd">塩谷郡塩谷町大字玉生１９４２-２</p><p class="gMapTel">0287（45）0162</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.297635,139.68505);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/homemade-moro/" target="_blank">（株）ホームメイド茂呂</a></p><p class="gMapAdd">下都賀郡岩舟町曲ケ島１８０６-４</p><p class="gMapTel">0282（55）8118</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.32935,139.694576);
	html = '<p class="gMapCom"><a href="http://www.fujico.info/hp/" target="_blank">フジコーポレーション（株）</a></p><p class="gMapAdd">下都賀郡岩舟町静和１０-１</p><p class="gMapTel">0282（55）7090</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.297635,139.68505);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/moro-zaimokuten/" target="_blank">（有）茂呂材木店</a></p><p class="gMapAdd">下都賀郡岩舟町大字曲ｹ島１８０６-４</p><p class="gMapTel">0282（55）2754</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.307517,139.670063);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/furusawa-komuten/" target="_blank">（有）古澤工務店</a></p><p class="gMapAdd">下都賀郡岩舟町大字静３３５５-３</p><p class="gMapTel">0282（55）2806</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.463349,139.826157);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/satou-syouten/" target="_blank">（有）佐藤商店</a></p><p class="gMapAdd">下都賀郡壬生町若草町１-３５</p><p class="gMapTel">0282（86）1034</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.459525,139.838884);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/masakiya-mokuzai/" target="_blank">正木屋木材（有）</a></p><p class="gMapAdd">下都賀郡壬生町壬生丁１０-１１</p><p class="gMapTel">0282（82）2862</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.452442,139.830954);
	html = '<p class="gMapCom">（株）ショールーム清水</p><p class="gMapAdd">下都賀郡壬生町壬生丁４４-２</p><p class="gMapTel">0282（82）5215</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.436735,139.912754);
	html = '<p class="gMapCom"><a href="http://www.suzukiya-mokuzai.co.jp/" target="_blank">（株）鈴木屋木材</a></p><p class="gMapAdd">河内郡上三川町大字上三川４９９２</p><p class="gMapTel">0285（56）2572</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.310675,139.591893);
	html = '<p class="gMapCom"><a href="http://www.mikamonoie.com/" target="_blank">栃木県木造住宅協同組合</a></p><p class="gMapAdd">佐野市浅沼町８０６</p><p class="gMapTel">0283（21）5757</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.313119,139.592731);
	html = '<p class="gMapCom"><a href="http://www.contihome.com/" target="_blank">（株）ナムラ</a></p><p class="gMapAdd">佐野市浅沼町８９８</p><p class="gMapTel">0283（24）2211</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.55899,139.766056);
	html = '<p class="gMapCom"><a href="http://www.ikhome.co.jp/" target="_blank">（株）ＩＫホーム</a></p><p class="gMapAdd">鹿沼市貝島町５８１-４</p><p class="gMapTel">0289（65）5555</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.402224,139.974919);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/hayashi-zaimokuten/" target="_blank">（株）林材木店</a></p><p class="gMapAdd">真岡市寺内１４３１</p><p class="gMapTel">0285（82）2685</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.873439,140.01576);
	html = '<p class="gMapCom"><a href="http://www.ha-juken.co.jp/" target="_blank">（有）住研</a></p><p class="gMapAdd">大田原市紫塚１-３-２６</p><p class="gMapTel">0287（23）7588</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.386997,139.740105);
	html = '<p class="gMapCom"><a href="http://www.next-one-net.co.jp/" target="_blank">（有）ネクストワン</a></p><p class="gMapAdd">栃木市平柳町１-２-２３</p><p class="gMapTel">0282（22）8001</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.398645,139.721953);
	html = '<p class="gMapCom"><a href="http://www.re-colors.com/" target="_blank">（株）カラーズ</a></p><p class="gMapAdd">栃木市野中町１３８２-２</p><p class="gMapTel">0282（20）1105</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.955901,140.035206);
	html = '<p class="gMapCom"><a href="http://www.tamura-k.co.jp/" target="_blank">田村建設（株）</a></p><p class="gMapAdd">那須塩原市上厚崎４３５-６</p><p class="gMapTel">0287（62）3574</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.889767,139.989413);
	html = '<p class="gMapCom"><a href="http://www.sougokikaku.co.jp/" target="_blank">（株）相互企画</a></p><p class="gMapAdd">那須塩原市南郷屋４-１６-１</p><p class="gMapTel">0287（36）3925</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.376838,139.970206);
	html = '<p class="gMapCom">（株）柴材木店</p><p class="gMapAdd">真岡市久下田８５６</p><p class="gMapTel">0285（74）0014</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.377279,139.969193);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/kikuya-kensetsu/" target="_blank">菊屋建設（株）</a></p><p class="gMapAdd">真岡市久下田９２４</p><p class="gMapTel">0285（74）0057</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.377279,139.969193);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/kikuya-kensetsu/" target="_blank">（有）菊屋材木店</a></p><p class="gMapAdd">真岡市久下田９２４</p><p class="gMapTel">0285（74）0057</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.748347,139.95141);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/tanaka-mokuzaikenchiku/" target="_blank">田中木材建築（有）</a></p><p class="gMapAdd">矢板市乙畑１４６０</p><p class="gMapTel">0287（48）0504</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.603434,139.849713);
	html = '<p class="gMapCom">（有）大沢建築</a></p><p class="gMapAdd">宇都宮市宝木本町１２３８-１２</p><p class="gMapTel">028（665）5906</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.794165,140.125166);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/gunji/" target="_blank">（有）郡司工務店</a></p><p class="gMapAdd">大田原市佐良土１４５５</p><p class="gMapTel">0287（98）3022</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.969634,140.055451);
	html = '<p class="gMapCom">セルシオール（株）</p><p class="gMapAdd">那須塩原市黒磯幸町６-１７</p><p class="gMapTel">0287（62）0350</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.496524,139.858229);
	html = '<p class="gMapCom">天空ホールディングス(株)</p><p class="gMapAdd">宇都宮市兵庫塚３-２７-９</p><p class="gMapTel">028（666）0512</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.432771,139.913365);
	html = '<p class="gMapCom"><a href="http://www.k2-homes.com/hp/sato-wood/" target="_blank">（株）佐藤材木店</a></p><p class="gMapAdd">河内郡上三川町上三川４９５７</p><p class="gMapTel">0285（56）2068</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.318515,139.461273);
	html = '<p class="gMapCom"><a href="http://www.watv.ne.jp/~fukujuu/" target="_blank">（有）福富住宅</a></p><p class="gMapAdd">足利市福富町2011</p><p class="gMapTel">0284（71）0654</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.32782145035119,139.86848026514053);
	html = '<p class="gMapCom"><a href="http://www.shima-ken.com" target="_blank">（有）シマ建築設計</a></p><p class="gMapAdd">小山市萱橋1167-1</p><p class="gMapTel">0285（49）3655</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.570597,139.894111);
	html = '<p class="gMapCom"><a href="http://www.tokenhouse.jp/" target="_blank">東建ハウス（株）</a></p><p class="gMapAdd">宇都宮市錦２丁目１-１６</p><p class="gMapTel">028（643）3577</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.386079,139.727222);
	html = '<p class="gMapCom"><a href="http://www.erewhon-dh.com/" target="_blank">（株）エレフォン</a></p><p class="gMapAdd">栃木市箱森町２-４７</p><p class="gMapTel">0282（25）2975</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.231533,139.746759);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/enomoto/" target="_blank">榎本建築</a></p><p class="gMapAdd">下都賀郡野木町南赤塚４６８</p><p class="gMapTel">0280(55)1210</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);
				}
			}
		);
	}
}

