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(34.621464, 132.85406);
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(34.694094,132.758813);
	html = '<p class="gMapCom"><a href="http://www.sumiyoshi.gr.jp/" target="_blank">（株）住吉</a></p><p class="gMapAdd">安芸高田市甲田町高田原１３７３-２</p><p class="gMapTel">0826（45）2351</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.387462,132.488412);
	html = '<p class="gMapCom"><a href="http://www.sgn-g.co.jp/" target="_blank">（株）スガノ</a></p><p class="gMapAdd">広島市南区大州１-１０-１５</p><p class="gMapTel">082（282）1411</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.398736,133.077572);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/masutani/" target="_blank">益谷建設（株）</a></p><p class="gMapAdd">三原市港町３-１７-１９</p><p class="gMapTel">0848（64）4630</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.394525,133.089604);
	html = '<p class="gMapCom"><a href="http://www.katsumurawood.com/" target="_blank">勝村木材（株）</a></p><p class="gMapAdd">三原市古浜２丁目１１番６号</p><p class="gMapTel">0848（62）6288</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.812234,132.868025);
	html = '<p class="gMapCom"><a href="http://www.mituya-ho.com/" target="_blank">（株）ミツヤホーミック</a></p><p class="gMapAdd">三次市三次町１２４-１</p><p class="gMapTel">0824（63）2361</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.344439,132.71839);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/shinhiro/" target="_blank">（株）新広</a></p><p class="gMapAdd">東広島市黒瀬町国近249-2</p><p class="gMapTel">0823（82）9360</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.34202,132.335708);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/hiroshima-taishin/" target="_blank">（株）小野産業</a></p><p class="gMapAdd">廿日市市木材港南４-３</p><p class="gMapTel">0829（34）3755</p>';
	map.addOverlay(createMarker(point, html, icon));

	 point = new GLatLng(34.556039,133.335899);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/kyoushin-sangyo/" target="_blank">共伸産業（株）</a></p><p class="gMapAdd">福山市駅家町万能倉１５８０</p><p class="gMapTel">084（972）6655</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.463385,133.400111);
	html = '<p class="gMapCom"><a href="http://sumai-refine.net/" target="_blank">朝日ナショナル（株）</a></p><p class="gMapAdd">福山市卸町２-１１</p><p class="gMapTel">084（954）8551</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.483894,133.362135);
	html = '<p class="gMapCom"><a href="http://www.daifukuhome.com/" target="_blank">大福ホーム（株）</a></p><p class="gMapAdd">福山市霞町３-１-１３</p><p class="gMapTel">084（921）3232</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.465671,133.3992);
	html = '<p class="gMapCom"><a href="http://www.mishimakenzai.co.jp/" target="_blank">三島建材（株）</a></p><p class="gMapAdd">福山市曙町６-６-１５</p><p class="gMapTel">0849（53）2277</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.39342,133.319625);
	html = '<p class="gMapCom">（株）マックハウジング</p><p class="gMapAdd">福山市沼隈町草深１８０５-３</p><p class="gMapTel">084（987）2017</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.531528,133.366409);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/habara-koumuten/" target="_blank">（有）羽原工務店</a></p><p class="gMapAdd">福山市神辺町川南１２２３</p><p class="gMapTel">084（962）1895</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.526709,133.427048);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/yamamoto-gumi/" target="_blank">（有）山本組</a></p><p class="gMapAdd">福山市春日町浦上７８</p><p class="gMapTel">084（947）0580</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.414562,133.277964);
	html = '<p class="gMapCom">（有）櫻建設</p><p class="gMapAdd">尾道市浦崎町354-2</p><p class="gMapTel">0848（73）3689</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.497374,133.443225);
	html = '<p class="gMapCom"><a href="http://www.mikawa-kk.com/" target="_blank">三河建設工業（株）</a></p><p class="gMapAdd">福山市大門町一丁目４５番３号</p><p class="gMapTel">084（941）6161</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.487838,133.346352);
	html = '<p class="gMapCom"><a href="http://www.kowabussan.co.jp/" target="_blank">光和物産（株）</a></p><p class="gMapAdd">福山市南本庄２丁目１２番２７号</p><p class="gMapTel">084（923）5155</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.487838,133.346352);
	html = '<p class="gMapCom">ＪＮＥＴ中国（株）</p><p class="gMapAdd">福山市南本庄2-12-27</p><p class="gMapTel">084（973）8580</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);
				}
			}
		);
	}
}

