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.253133, 140.307656);
	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.326172,140.308516);
	html = '<p class="gMapCom"><a href="http://www.carpenters.jp/" target="_blank">米川建築（株）</a></p><p class="gMapAdd">笠間市矢野下１４８７-６</p><p class="gMapTel">0296（77）3318</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.119305,140.279328);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/maekawa/" target="_blank">前川建築業</a></p><p class="gMapAdd">かすみがうら市宍倉６１９６-１８８</p><p class="gMapTel">029（897）0728</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.160616,140.087312);
	html = '<p class="gMapCom"><a href="http://www.kikuchizaimokuten.com/" target="_blank">（有）菊池材木店</a></p><p class="gMapAdd">つくば市大字君島８９３</p><p class="gMapTel">0298（67）0847</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.13183,140.096656);
	html = '<p class="gMapCom"><a href="http://www.sinoya.co.jp/" target="_blank">篠屋木材工業（株）</a></p><p class="gMapAdd">つくば市大曽根２６６９-４</p><p class="gMapTel">0298（64）2881</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(35.943823,140.45713);
	html = '<p class="gMapCom"><a href="http://homepage2.nifty.com/kato-kmt/" target="_blank">加藤工務店</a></p><p class="gMapAdd">稲敷市本新３６９</p><p class="gMapTel">0299（78）2171</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.118567,139.79518);
	html = '<p class="gMapCom"><a href="http://www.shinohara-sakai.co.jp/" target="_blank">（株）篠原工務店</a></p><p class="gMapAdd">猿島郡境町松岡町７６-１</p><p class="gMapTel">0280（87）6666</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.18618,139.941449);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/yoshikawa-zaimokuten/" target="_blank">（有）吉川材木店</a></p><p class="gMapAdd">下妻市長塚４６８-１</p><p class="gMapTel">0296（44）2802</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(35.978434,140.154976);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/mizushin-mokuzai/" target="_blank">（有）あすなろ</a></p><p class="gMapAdd">牛久市柏田町１０６４-１</p><p class="gMapTel">0298（72）5628</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.299645,139.879255);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/endo-mokuzai/" target="_blank">（株）遠藤木材</a></p><p class="gMapAdd">結城市大字結城２４３</p><p class="gMapTel">0296（32）5135</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.000835,140.529613);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/matsuzaki-material/" target="_blank">マツザキマテリアル（株）</a></p><p class="gMapAdd">行方市矢幡１８８１-１２</p><p class="gMapTel">0299（73）0131</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.362688,140.105078);
	html = '<p class="gMapCom"><a href="http://www16.plala.or.jp/marukawa/" target="_blank">丸川木材（株）</a></p><p class="gMapAdd">桜川市岩瀬２９８</p><p class="gMapTel">0296（57）3661</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.365084,140.103259);
	html = '<p class="gMapCom"><a href="http://www.maruwakensetsu.co.jp/" target="_blank">丸和建設（株）</a></p><p class="gMapAdd">桜川市御領１-３４</p><p class="gMapTel">0296（76）2771</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.231484,140.329242);
	html = '<p class="gMapCom"><a href="http://www.maekawa-f.com/" target="_blank">（株）前川林業</a></p><p class="gMapAdd">小美玉市中野谷１１５-イ</p><p class="gMapTel">0299（47）0131</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.223376,140.32157);
	html = '<p class="gMapCom">（有）斎藤建設</p><p class="gMapAdd">小美玉市中野谷３２５</p><p class="gMapTel">0299（49）1326</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.113566,139.976226);
	html = '<p class="gMapCom"><a href="http://www.namai-zaimoku.com/" target="_blank">（株）生井</a></p><p class="gMapAdd">常総市新石下３６６２</p><p class="gMapTel">0297（42）0311</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.631895,140.396916);
	html = '<p class="gMapCom"><a href="http://www1.ocn.ne.jp/~m.wood/" target="_blank">合名会社桝屋商店</a></p><p class="gMapAdd">常陸大宮市山方６３７</p><p class="gMapTel">0295（57）2059</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(35.870071,140.650362);
	html = '<p class="gMapCom">（有）小堀工務店</p><p class="gMapAdd">神栖市石神６４４</p><p class="gMapTel">0299（92）3169</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(35.841804,140.714879);
	html = '<p class="gMapCom"><a href="http://www.e-zaimoku.com/" target="_blank">（有）椙山材木店</a></p><p class="gMapAdd">神栖市太田３２０９</p><p class="gMapTel">0479（46）0164</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.348471,140.456615);
	html = '<p class="gMapCom">（株）エス・ディ・ワークス</p><p class="gMapAdd">水戸市笠原町２８８-１２</p><p class="gMapTel">029（244）0924</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.376262,140.440987);
	html = '<p class="gMapCom"><a href="http://www.qs-home.jp/pc/" target="_blank">（株）堀久工務店</a></p><p class="gMapAdd">水戸市見川２-５２-４</p><p class="gMapTel">029（225）3033</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.393086,140.443778);
	html = '<p class="gMapCom"><a href="http://www.buildup1998.com/" target="_blank">（株）ビルドアップ</a></p><p class="gMapAdd">水戸市上水戸４-６-２３</p><p class="gMapTel">029（303）6305</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.327341,140.463704);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/mito-kenshin/" target="_blank">（株）水戸建親センター</a></p><p class="gMapAdd">水戸市住吉町１６８</p><p class="gMapTel">029（247）1141</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.387356,140.437398);
	html = '<p class="gMapCom"><a href="http://www.ones-home.co.jp/" target="_blank">（有）ＯＮＥ’Ｓ　ＨＯＭＥ</a></p><p class="gMapAdd">水戸市松ヶ丘１-２-２１</p><p class="gMapTel">029（231）1155</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.350416,140.441858);
	html = '<p class="gMapCom"><a href="http://www.office8.co.jp/" target="_blank">オフィスエイト（株）</a></p><p class="gMapAdd">水戸市千波町２０６７-８</p><p class="gMapTel">029（244）0084</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.242774,140.187852);
	html = '<p class="gMapCom">渡辺木材（株）</p><p class="gMapAdd">石岡市柿岡１８２７番地</p><p class="gMapTel">0299（43）0031</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.203256,140.291216);
	html = '<p class="gMapCom"><a href="http://www.ebenhouse.co.jp/" target="_blank">（株）エーベンハウス</a></p><p class="gMapAdd">石岡市石岡１３４４６-３６</p><p class="gMapTel">0299（27）5858</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.248368,139.973332);
	html = '<p class="gMapCom"><a href="http://www.saiken-s.co.jp/pc/" target="_blank">斉藤建築工業（株）</a></p><p class="gMapAdd">筑西市辻１５１０-３</p><p class="gMapTel">0296（37）4541</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.092159,140.208104);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/honda/" target="_blank">（株）本田</a></p><p class="gMapAdd">土浦市東真鍋町９-３５</p><p class="gMapTel">029（822）2211</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.441787,140.379547);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/osaki/" target="_blank">（株）大崎材木店</a></p><p class="gMapAdd">東茨城郡城里町大字上入野２１４２-１</p><p class="gMapTel">029（288）3535</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.314492,140.568403);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/yuasa/" target="_blank">（株）湯浅</a></p><p class="gMapAdd">東茨城郡大洗町磯浜町１１３３</p><p class="gMapTel">029（267）5281</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.568574,140.646577);
	html = '<p class="gMapCom"><a href="http://www.nichimoku.co.jp/" target="_blank">日木産業（株）</a></p><p class="gMapAdd">日立市鮎川町４丁目１番８号</p><p class="gMapTel">0294（36）4451</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.623462,140.668872);
	html = '<p class="gMapCom"><a href="http://www.masumi-kensetsu.jp/" target="_blank">益三建設（株）</a></p><p class="gMapAdd">日立市滑川本町４-２５-１６</p><p class="gMapTel">0294（24）5533</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.236888,140.513898);
	html = '<p class="gMapCom"><a href="http://www5.ocn.ne.jp/~k.yosi/index.htm" target="_blank">（株）吉川工務店</a></p><p class="gMapAdd">鉾田市造谷１２０９番地１</p><p class="gMapTel">0291（37）0623</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.128283,140.541387);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/takeda/" target="_blank">（有）武田製材所</a></p><p class="gMapAdd">鉾田市二重作１４７３</p><p class="gMapTel">0291（39）3282</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.151741,140.514959);
	html = '<p class="gMapCom">鈴木工務店</p><p class="gMapAdd">鉾田市鉾田１６３５</p><p class="gMapTel">0291（32）3483</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(35.903199,140.186153);
	html = '<p class="gMapCom"><a href="http://www.takeya.ne.jp/" target="_blank">（株）竹屋</a></p><p class="gMapAdd">龍ケ崎市栄町４３５６</p><p class="gMapTel">0297（64）5168</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(35.930078,140.140792);
	html = '<p class="gMapCom"><a href="http://www.isekiya-komuten.com/" target="_blank">（株）伊勢喜屋工務店</a></p><p class="gMapAdd">龍ケ崎市佐貫３-６-７</p><p class="gMapTel">0297（60）2038</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(35.965622,140.640652);
	html = '<p class="gMapCom"><a href="http://www.sopia.or.jp/safety/" target="_blank">（株）セーフティハウス</a></p><p class="gMapAdd">鹿嶋市宮中５２７３-４</p><p class="gMapTel">0299（85）2185</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.295736,139.929265);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/hirose/" target="_blank">廣瀬建築</a></p><p class="gMapAdd">筑西市下川島８２４－３</p><p class="gMapTel">0296（28）0398</p>';
	map.addOverlay(createMarker(point, html, icon));
	
	point = new GLatLng(36.33517,140.39171);
	html = '<p class="gMapCom"><a href="http://www.hayashijyuken.co.jp/" target="_blank">（有）林住建</a></p><p class="gMapAdd">水戸市高田町２２６－２</p><p class="gMapTel">029（259）5946</p>';
	map.addOverlay(createMarker(point, html, icon));


	point = new GLatLng(35.788669,140.772168);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/ill-home/" target="_blank">（株）アイルホーム</a></p><p class="gMapAdd">神栖市土合南２－１１－１４</p><p class="gMapTel">0479（26）3350</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.377936, 140.2238);
	html = '<p class="gMapCom"><a href="http://lohas-h.com/" target="_blank">（株）ロハスホーム</a></p><p class="gMapAdd">笠間市笠間１０８５</p><p class="gMapTel">0296（73）4062</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(35.980208,140.143333);
	html = '<p class="gMapCom"><a href="http://iekaku.com/" target="_blank">家づくり革新暁（株）</a></p><p class="gMapAdd">牛久市中央５丁目４-４-２</p><p class="gMapTel">029(801)0664</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);
				}
			}
		);
	}
}

