﻿    var map;
    var marker_list=[];
    var txt_list=[];

    function load() {
      if (GBrowserIsCompatible()) {
        //地図を作成
        map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(34.6984270078703, 135.49526453018188), 16);
		
		//マップコントローラを付ける
		map.addControl(new GLargeMapControl());
        
        //各マーカを作成
        var txt="<div style='width:200px;height:40px;'><h3><a href='#point1'>ポイント1</a></h3></div>";
        txt_list.push(txt);
        addMarker(new GLatLng(34.699606, 135.495668), txt);
        
        txt="<div style='width:200px;height:40px;'><h3><a href='#point2'>ポイント2</a></h3></div>";
        txt_list.push(txt);
        addMarker(new GLatLng(34.6970039, 135.495435), txt);
		
        txt="<div style='width:200px;height:40px;'><h3><a href='#point3'>ポイント3</a></h3></div>";
        txt_list.push(txt);
        addMarker(new GLatLng(34.69661245319206, 135.49529135227203), txt);

        txt="<div style='width:200px;height:40px;'><h3><a href='#point4'>ポイント4</a></h3></div>";
        txt_list.push(txt);
        addMarker(new GLatLng(34.69658, 135.495074), txt);
		
        txt="<div style='width:200px;height:40px;'><h3><a href='#point5'>ポイント5</a></h3></div>";
        txt_list.push(txt);
        addMarker(new GLatLng(34.69641530340324, 135.49381613731384), txt);
		
        txt="<div style='width:200px;height:40px;'><h3><a href='#point6'>シナジーマーケティング本社</a></h3></div>";
        txt_list.push(txt);
        addMarker(new GLatLng(34.6958429, 135.4929103), txt);
		
      }
    }
    function addMarker(latlng,txt){
        //マーカーを作成
        var marker = new GMarker(latlng);
        
        GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(txt);
        });
        
        //マーカーのコンストラクタを配列に記憶
        marker_list.push(marker);
        
        //マーカーを地図上に配置
        map.addOverlay(marker);
		
		//マーカーに擬似的にクリックされたイベントを発生させる
GEvent.trigger(marker,"click");
    }
    
    function clickMarker(index){
        //吹き出しを表示する
        marker_list[index].openInfoWindowHtml(txt_list[index]);
    }
	

    window.onload=load;
    window.onunload=GUnload;