    //<![CDATA[
 
    var map = new GMap(document.getElementById("map"));
    var geocoder = new GClientGeocoder();
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.addControl(new GScaleControl());

    //
    function showAddress(address) {
      geocoder.getLatLng(
        address,
        function(point) {
          if (!point) {
            alert(address + "は検索できません。\n住所、ランドマーク名称などで入力してください ");
          } else {
            map.setCenter(point, 15);
            }
        }
      );
    }

    // チェックボックス
    function myCheck(){
      var cnt = 0;
      var str = "";
      for (i=0 ; i < parent.document.checkForm.length-1 ; i++){
        if (parent.document.checkForm.elements[i].checked == true){
          cnt++;
          str += "filename"+cnt+"="+parent.document.checkForm.elements[i].value+"&";
        }
      }
      str = str.substring(0,str.length-1);
      location.href = "mapviewer_cafe.cgi?"+str;
    }

    // Creates a marker whose info window displays the given number
    function addMarker(map, lng, lat, html) {
      var point = new GPoint(lng, lat);
      var marker = new GMarker(point);

      // Show this marker's index in the info window when it is clicked
      GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(html);
      });
      map.addOverlay(marker);
    }  

    function setMarker(map, id, lng, lat, type, contents, link) {
      var icon = new GIcon();
      var point = new GPoint(lng, lat);

      /* type に対応するアイコンのセット */

      if (type == "" )   { type = "0"; }

      if (type == "jr")  {
        var zoom = map.getZoomLevel();
        var size = (contents / 25000) * (9 - zoom);
						/*円が適度な大きさになるように計算*/
        var anc = size / 2;			/*中心座標を計算*/
        icon.image = "../img/redcircle100.png";
        icon.iconAnchor = new GPoint(anc,anc);
        icon.iconSize = new GSize(size,size);
        icon.infoWindowAnchor = new GPoint(anc, anc);

	GEvent.addListener(map, "zoom", function(zoomold,zoomnew) {
        setIconSize(map,marker,icon,contents); 
        });
      }

      else  {

        if (type == "tul")  { icon.image = "../img/cafe_tul.png";
                              icon.iconAnchor = new GPoint(10, 34); }
				else if (type == "do")  { icon.image = "../img/cafe_do.png";
                                  icon.iconAnchor = new GPoint(10, 32); }
        else if (type == "sb")  { icon.image = "../img/cafe_sb.png";
                                  icon.iconAnchor = new GPoint( 8, 32); }
        else if (type == "sa")  { icon.image = "../img/cafe_sa.png";
                                  icon.iconAnchor = new GPoint(11, 34); }
        else if (type == "se")  { icon.image = "../img/cafe_se.png";
                                  icon.iconAnchor = new GPoint(10, 34); }
        else if (type == "ex")  { icon.image = "../img/cafe_ex.png";
                                  icon.iconAnchor = new GPoint(12, 36); }
        else if (type == "be")  { icon.image = "../img/cafe_be.png";
                                  icon.iconAnchor = new GPoint(10, 34); }
        else if (type == "pr")  { icon.image = "../img/cafe_pr.png";
                                  icon.iconAnchor = new GPoint(12, 32); }
        else if (type == "co")  { icon.image = "../img/cafe_co.png";
                                  icon.iconAnchor = new GPoint( 9, 36); }
        else if (type == "ve")  { icon.image = "../img/cafe_ve.png";
                                  icon.iconAnchor = new GPoint( 9, 35); }
        else if (type == "utq") { icon.image = "../img/utq.png";
                                  icon.iconAnchor = new GPoint(20, 20); }
        else                    { icon.image = "../img/base.png";
                                  icon.iconAnchor = new GPoint(10, 34); }
      
        icon.iconSize = new GSize(20,34);
        icon.infoWindowAnchor = new GPoint(15, 1);
      }

      var marker = new GMarker(point, icon);

      /* link の表示 */
      var html = "<b>" + link + "<br>" + id + "</b><hr width=\"200\" align=\"left\" color=\"ffcccc\">" + contents + "";

      GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(html);
      });

/*      return marker; */
      map.addOverlay(marker);
    }

/*  zoomにより画像サイズ変更 */

    function setIconSize(map,marker,icon,contents) {
      /* zoom に対応するアイコンのセット */

      map.removeOverlay(marker);
      var zoom = map.getZoomLevel();
      var size = contents / 25000 * (9 - zoom);
      var anc = size / 2;
      
      if(size < 1){
        size = 1;
      }
      icon.iconAnchor = new GPoint(anc,anc);
      icon.iconSize = new GSize(size,size);
      icon.infoWindowAnchor = new GPoint(anc, anc);

      map.addOverlay(marker);

    }


    // Create a linkmarker 
    var markers = []; 
    function addlinkMarker(map, lng, lat, html) {
      var point = new GPoint(lng, lat);
      var marker = new GMarker(point);

      markers[markers.length] = marker 
         // Write a Javascript function to open a marker when passed an element of this array: 
         function markerlink(marker) { 
         GEvent.trigger(marker,"click"); 
         }

      map.addOverlay(marker);
    }

