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.755841, 135.531295);
	map.setCenter(center, 10);

	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.457419,135.398988);
	html = '<p class="gMapCom"><a href="http://www.nakazawa-kenpan.co.jp" target="_blank">ナカザワ建販（株）</a></p><p class="gMapAdd">岸和田市額原町１８０</p><p class="gMapTel">0724（41）3580</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.849245,135.631129);
	html = '<p class="gMapCom"><a href="http://www.lilys-home.net/" target="_blank">（株）すずらん工務店</a></p><p class="gMapAdd">高槻市千代田町２１-６</p><p class="gMapTel">072（675）0037</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.785947,135.534039);
	html = '<p class="gMapCom"><a href="http://www.e-house.co.jp/better-home/" target="_blank">（株）ベターホーム</a></p><p class="gMapAdd">吹田市岸部北５-３０-１</p><p class="gMapTel">06（6387）5557</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.78515,135.5339);
	html = '<p class="gMapCom"><a href="http://www.okamei.co.jp/" target="_blank">（株）岡本銘木店</a></p><p class="gMapAdd">吹田市岸部北５-３２-１</p><p class="gMapTel">06（6388）3411</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.633306,135.511236);
	html = '<p class="gMapCom"><a href="http://housenet.jp/" target="_blank">（株）ハウスネットプラス</a></p><p class="gMapAdd">大阪市阿倍野区王子町２-２-６</p><p class="gMapTel">06（7897）8002</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.679559,135.514109);
	html = '<p class="gMapCom"><a href="http://www.takara-net.co.jp/" target="_blank">タカラ通商（株）</a></p><p class="gMapAdd">大阪市中央区和泉町２-２-１９</p><p class="gMapTel">06（6946）1133</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.657056,135.527025);
	html = '<p class="gMapCom"><a href="http://www.naniwa-touch.co.jp/" target="_blank">（株）ナニワ</a></p><p class="gMapAdd">大阪市天王寺区烏ケ辻１-３-６</p><p class="gMapTel">06（6771）9123</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.619827,135.540269);
	html = '<p class="gMapCom"><a href="http://www.airisuhome.com/pc/" target="_blank">アイリスホーム（株）</a></p><p class="gMapAdd">大阪市東住吉区中野４丁目４番３３号</p><p class="gMapTel">06（4302）8601</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.668529,135.499791);
	html = '<p class="gMapCom"><a href="http://www.yoshitomi-k.co.jp/" target="_blank">吉富建設（株）</a></p><p class="gMapAdd">大阪市中央区道頓堀２－２－２０</p><p class="gMapTel">06（6214）6056</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.682183,135.514115);
	html = '<p class="gMapCom"><a href="http://www.inakagurasi.co.jp/" target="_blank">キタノ（株）</a></p><p class="gMapAdd">大阪市中央区常盤町２-２-３０-１階</p><p class="gMapTel">06（6946）0161</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.742061,135.576691);
	html = '<p class="gMapCom"><a href="http://www.fujikoumuten.co.jp/" target="_blank">富士工務店（株）</a></p><p class="gMapAdd">守口市八雲東町１丁目２２番２号</p><p class="gMapTel">06（6903）9991</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.754714,135.626256);
	html = '<p class="gMapCom"><a href="http://www.maedagumi.co.jp/" target="_blank">（株）前田組</a></p><p class="gMapAdd">寝屋川市大成町1-1</p><p class="gMapTel">072（824）1866</p>';
	map.addOverlay(createMarker(point, html, icon));

	point = new GLatLng(34.747917,135.62269);
	html = '<p class="gMapCom"><a href="http://www.eiwa-j.jp" target="_blank">エイワ住建（株）</a></p><p class="gMapAdd">寝屋川市下木田町16-18</p><p class="gMapTel">072（824）2451</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);
				}
			}
		);
	}
}

