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(37.409914, 140.377464);
map.setCenter(center, 8);

	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.893645,140.782597);
	html = '<p class="gMapCom"><a href="http://www.908home.com" target="_blank">クレハ錦建設（株）</a></p><p class="gMapAdd">いわき市錦町綾ノ町１６</p><p class="gMapTel">0246（64）8185</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.945845,140.913205);
	html = '<p class="gMapCom">崎村工業</p><p class="gMapAdd">いわき市小名浜字古湊１１７</p><p class="gMapTel">0246（53）3993</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.965153,140.8518);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/mk-matsumoto/" target="_blank">（有）エムケー松本建築</a></p><p class="gMapAdd">いわき市泉ケ丘１-２-１８</p><p class="gMapTel">0246（56）1939</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.854833,140.605156);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/watanabe-koumuten/" target="_blank">（株）渡辺工務店</a></p><p class="gMapAdd">伊達市梁川町小梁川２７-１</p><p class="gMapTel">024（577）0409</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.561215,139.952966);
	html = '<p class="gMapCom">光和建材（株）</p><p class="gMapAdd">会津若松市河東町東長原字長谷地１１７</p><p class="gMapTel">0242（76）0701</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.376015,140.385996);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/oohara-komuten/" target="_blank">（株）東京クリーン</a></p><p class="gMapAdd">郡山市安積町日出山２-２１-１</p><p class="gMapTel">024（942）0338</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.802757,140.92398);
	html = '<p class="gMapCom"><a href="http://www.toyo-web.net/" target="_blank">（株）トーヨー建設</a></p><p class="gMapAdd">相馬市中村１丁目２-３</p><p class="gMapTel">0244（35）1111</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.032761,140.482972);
	html = '<p class="gMapCom"><a href="http://www.njm-precut.co.jp/" target="_blank">中井住宅木販（株）</a></p><p class="gMapAdd">東白川郡鮫川村大字赤坂西野字寅卯平３２-１</p><p class="gMapTel">0247（49）3161</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.87233,140.422519);
	html = '<p class="gMapCom"><a href="http://www.oshida-seizai.jp/" target="_blank">（株）押田製材所</a></p><p class="gMapAdd">東白川郡矢祭町東舘字桃木町１５</p><p class="gMapTel">0247（46）3138</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.618513,140.963081);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/chiba-house/" target="_blank">チバハウス</a></p><p class="gMapAdd">南相馬市原町区牛来字穴田４２-１</p><p class="gMapTel">0244（22）8111</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.635505,140.939858);
	html = '<p class="gMapCom"><a href="http://www.soma.or.jp/~irishome/" target="_blank">（株）アイリスホーム</a></p><p class="gMapAdd">南相馬市原町区大木戸字金場１０-１</p><p class="gMapTel">0244（24）4660</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.560112,140.508508);
	html = '<p class="gMapCom"><a href="http://www.marusan-lumber.co.jp/" target="_blank">丸三木材（株）</a></p><p class="gMapAdd">二本松市小浜字鳥居町２７-３</p><p class="gMapTel">0243（55）2255</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.779412,140.465887);
	html = '<p class="gMapCom"><a href="http://www.hot-living.com/" target="_blank">ほっとリビング</a></p><p class="gMapAdd">福島市御山字中川原８４-１</p><p class="gMapTel">024（525）0525</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.58083,139.656389);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/watanabe-juuken/" target="_blank">（株）渡部住建</a></p><p class="gMapAdd">耶麻郡西会津町野沢字諏訪西甲１０６１</p><p class="gMapTel">0241（45）3526</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.928835, 140.831327);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/act-style/" target="_blank">（有）アクト</a></p><p class="gMapAdd">いわき市小浜町北ノ作３３-１４９</p><p class="gMapTel">0246（75）1223</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.581513,140.122296);
	html = '<p class="gMapCom"><a href="http://www.glife.co.jp/" target="_blank">（株）グリーンライフ</a></p><p class="gMapAdd">耶麻郡猪苗代町字清水前２７４８-１</p><p class="gMapTel">0242（72）1769</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.192853,139.670365);
	html = '<p class="gMapCom"><a href="http://www.haganuma.co.jp/" target="_blank">（株）芳賀沼製作</a></p><p class="gMapAdd">南会津郡南会津町針生字小坂４０-１</p><p class="gMapTel">0241（64）2221</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.968197,140.905471);
	html = '<p class="gMapCom"><a href="http://www.kanehana.jp/" target="_blank">カネハナ住材（株）</a></p><p class="gMapAdd">いわき市小名浜岡小名字作前７-１</p><p class="gMapTel">0246（54）4485</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.203067, 139.771057);
	html = '<p class="gMapCom">（株）田浦</p><p class="gMapAdd">南会津郡南会津町田島字元八幡甲315-4</p><p class="gMapTel">0241（61）1168</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.596968,139.891617);
	html = '<p class="gMapCom">ヤマト建設</p><p class="gMapAdd">喜多方市塩川町東栄町４丁目４番地１１号</p><p class="gMapTel">0241（27）5233</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.59496,139.890045);
	html = '<p class="gMapCom">（株）ナベヤ一重</p><p class="gMapAdd">喜多方市塩川町新町１８４２番地</p><p class="gMapTel">0241（27）2064</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.049734,140.891703);
	html = '<p class="gMapCom">三田建設（株）</p><p class="gMapAdd">いわき市平字菱川町5-7</p><p class="gMapTel">0246（25）2555</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(37.658303,139.914521);
	html = '<p class="gMapCom"><a href="http://www.tsukahara-home.com/" target="_blank">（有）塚原ホーム</a></p><p class="gMapAdd">喜多方市関柴町下柴字東住485-1</p><p class="gMapTel">0241（22）4521</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.960431,140.897703);
	html = '<p class="gMapCom">（株）ヒロ・工房</p><p class="gMapAdd">いわき市小名浜君ケ塚町１８-２</p><p class="gMapTel">0246（92）4562</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(36.887198,140.749897);
	html = '<p class="gMapCom">（有）旭興業</p><p class="gMapAdd">いわき市勿来町酒井竹ノ内６５-３</p><p class="gMapTel">0246(64)7799</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);
				}
			}
		);
	}
}

