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(33.232944, 131.606941);
	map.setCenter(center, 11);

	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(33.120587,131.806744);
	html = '<p class="gMapCom">（有）佐々木総合建設</p><p class="gMapAdd">臼杵市臼杵７０２-３２</p><p class="gMapTel">0972（63）3818</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(32.961906,131.898102);
	html = '<p class="gMapCom"><a href="http://housefactory.jp/" target="_blank">（有）ハウスファクトリー</a></p><p class="gMapAdd">佐伯市中村北町２-２２</p><p class="gMapTel">0972（23）8887</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(32.972027,131.906857);
	html = '<p class="gMapCom">藤沢商店（有）</p><p class="gMapAdd">佐伯市鶴谷町１-３-５</p><p class="gMapTel">0972（23）2211</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.193454,131.612578);
	html = '<p class="gMapCom"><a href="http://www18.ocn.ne.jp/~momi/" target="_blank">（有）西岡商会</a></p><p class="gMapAdd">大分市鴛野８７２-５</p><p class="gMapTel">097（569）6681</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.200447,131.669432);
	html = '<p class="gMapCom">仲道トーヨー（株）</p><p class="gMapAdd">大分市横尾７６８-１</p><p class="gMapTel">097（520）2688</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.25293,131.664323);
	html = '<p class="gMapCom"><a href="http://www.k2-homes.com/hp/nakayama-8888/" target="_blank">（有）中山建材店</a></p><p class="gMapAdd">大分市向原東２-１-２８</p><p class="gMapTel">097（558）8888</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.244158,131.649396);
	html = '<p class="gMapCom"><a href="http://touyo.net/" target="_blank">（株）東洋都市開発</a></p><p class="gMapAdd">大分市新栄町１２-２４</p><p class="gMapTel">097（556）4888</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.238826,131.582744);
	html = '<p class="gMapCom">（株）大塚木材</p><p class="gMapAdd">大分市大字駄原２１１１</p><p class="gMapTel">097（535）0522</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.140266,131.653662);
	html = '<p class="gMapCom"><a href="http://www.gotosogo.com/" target="_blank">後藤総合工業（株）</a></p><p class="gMapAdd">大分市大字竹中２７３０</p><p class="gMapTel">097（597）1212</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.246605,131.630723);
	html = '<p class="gMapCom"><a href="http://www.oitabeniya.co.jp/" target="_blank">（株）大分ベニヤ商会</a></p><p class="gMapAdd">大分市東浜１-８-６</p><p class="gMapTel">097（547）8837</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.23828,131.796403);
	html = '<p class="gMapCom"><a href="http://www.shutoh-kenchiku.com/" target="_blank">（有）シュトウ建築</a></p><p class="gMapAdd">大分市本神崎３８８</p><p class="gMapTel">097（576）1150</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.209087,131.586527);
	html = '<p class="gMapCom">（有）マテリアル工房</p><p class="gMapAdd">大分市明磧７-３</p><p class="gMapTel">097（544）4413</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.57546,131.209698);
	html = '<p class="gMapCom"><a href="http://www7.ocn.ne.jp/~ebutiken/" target="_blank">江渕建設（株）</a></p><p class="gMapAdd">中津市大字永添８２０-１１０</p><p class="gMapTel">0979（23）2697</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.579945,131.276733);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/seiwa/" target="_blank">（株）青和</a></p><p class="gMapAdd">中津市大字鍋島１１３</p><p class="gMapTel">0979（32）6262</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.076421,131.849022);
	html = '<p class="gMapCom"><a href="http://www.endo-kenzai.jp/" target="_blank">（有）遠藤建材社</a></p><p class="gMapAdd">津久見市門前町８-２１</p><p class="gMapTel">0972（82）2882</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.547472,131.431583);
	html = '<p class="gMapCom"><a href="http://www.kurashikitakumikai.jp/" target="_blank">倉敷匠会</a></p><p class="gMapAdd">豊後高田市界１５８０</p><p class="gMapTel">0978（24）0530</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.559224,131.433952);
	html = '<p class="gMapCom"><a href="http://www.nakamura-kenzaiten.co.jp/" target="_blank">（株）中村建材店</a></p><p class="gMapAdd">豊後高田市大字高田２１４５-１</p><p class="gMapTel">0978（22）2307</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.551072,131.448335);
	html = '<p class="gMapCom"><a href="http://www.sasaki-kensetu.com/" target="_blank">佐々木建設（株）</a></p><p class="gMapAdd">豊後高田市来縄２８７０</p><p class="gMapTel">0978（24）1115</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.297081255867965,131.4808103442192);
	html = '<p class="gMapCom">（有）丸二首藤工務店</p><p class="gMapAdd">別府市鶴見７組１</p><p class="gMapTel">0977（24）2406</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.586917,131.207068);
	html = '<p class="gMapCom"><a href="http://ameblo.jp/agelife/" target="_blank">（株）エッジライフ</a></p><p class="gMapAdd">中津市大字宮夫２４７－１<br>サンサン通り</p><p class="gMapTel">0979（53）8808</p>';
	map.addOverlay(createMarker(point, html, icon));


	point = new GLatLng(33.192154,131.610103);
	html = '<p class="gMapCom"><a href="http://www.kino-sumai.com/" target="_blank">（有）わさだ工務店</a></p><p class="gMapAdd">大分市大字宮崎１４９２－１５１</p><p class="gMapTel">097（568）5080</p>';
	map.addOverlay(createMarker(point, html, icon));


	point = new GLatLng(33.552947,131.357593);
	html = '<p class="gMapCom"><a href="http://www15.ocn.ne.jp/~egami104/" target="_blank">江上トーヨー住器（株）</a></p><p class="gMapAdd">宇佐市江須賀265-1</p><p class="gMapTel">0978（38）1573</p>';
	map.addOverlay(createMarker(point, html, icon));


	point = new GLatLng(33.179735,131.663219);
	html = '<p class="gMapCom"><a href="http://www.mad-oita.com/pc/" target="_blank">（有）エムエーディ</a></p><p class="gMapAdd">大分市松岡5496-1</p><p class="gMapTel">097（520）1976</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.326243,130.927605);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/ito-fudosan/" target="_blank">（株）伊藤不動産</a></p><p class="gMapAdd">日田市玉川3丁目1459-1</p><p class="gMapTel">0973（22）4034</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.308869,130.910016);
	html = '<p class="gMapCom">梶原建築</p><p class="gMapAdd">日田市石井1-371-1</p><p class="gMapTel">0973（22）3202</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.440519,131.35194);
	html = '<p class="gMapCom">下村建設（株）</p><p class="gMapAdd">宇佐市安心院町下毛1890-1</p><p class="gMapTel">0978（44）0247</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.303181,130.935467);
	html = '<p class="gMapCom">江藤建装</p><p class="gMapAdd">日田市誠和町７６６-５</p><p class="gMapTel">0973（23）5620</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.320578,130.955606);
	html = '<p class="gMapCom"><a href="http://www.b-net.kcv.jp/~nogami-k/" target="_blank">（有）野上工務店</a></p><p class="gMapAdd">日田市大字北豆田１７７７-１</p><p class="gMapTel">0973（22）2880</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.570725,131.206438);
	html = '<p class="gMapCom"><a href="http://proshop-nii.com/" target="_blank">（株）新居商店</a></p><p class="gMapAdd">中津市永添2333-18</p><p class="gMapTel">0979（22）2890</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.298865,130.944719);
	html = '<p class="gMapCom">増田建築</p><p class="gMapAdd">日田市大宮町１２１６-１</p><p class="gMapTel">0973（24）3485</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.190687,131.659072);
	html = '<p class="gMapCom"><a href="http://www.renohouse.jp/" target="_blank">（株）ＲｅｎｏＨｏｕｓｅＣｏｍｐａｎｙ</a></p><p class="gMapAdd">大分市公園通り３-１６-２</p><p class="gMapTel">097（594）0016</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.532169,131.331796);
	html = '<p class="gMapCom">藤田工務店</p><p class="gMapAdd">宇佐市石田４０-２</p><p class="gMapTel">0978（34）9061</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(33.241761,131.636325);
	html = '<p class="gMapCom">（株）ありたや</p><p class="gMapAdd">大分市牧１丁目１番１号</p><p class="gMapTel">097(558)0248</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);
				}
			}
		);
	}
}

