    //<![CDATA[

 /*@cc_on _d=document;eval('var document=_d')@*/
 
    var map = new GMap2(document.getElementById("map"));
 //   var mgrOptions = { borderPadding: 100, maxZoom: 19, trackMarkers: false };

    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.addControl(new GScaleControl());
    map.addControl(new GOverviewMapControl());
    var geocoder = new GClientGeocoder();
    var manager = new GMarkerManager(map);


   // map.enableContinuousZoom();
    map.enableScrollWheelZoom();

    // Creates a marker whose info window displays the given number

    function addMarker(map, lng, lat, html) {
      var point = new GLatLng(lat, lng);
      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 GLatLng(lat, lng);

      open_flag = 0;

      /* type に対応するアイコンのセット */

      if ( type == "" )   { type = "0"; }

      if ( type == "1000001" )   { type = 1; open_flag = 1; }
    
      if ( (type >= "0") && (type <= "9")  )  {
         if (type == "1")	{ icon.image = "../img/red.png";    } else	
         if (type == "2")       { icon.image = "../img/yellow.png"; } else
         if (type == "3")       { icon.image = "../img/green.png";  } else
         if (type == "4")       { icon.image = "../img/blue.png";   } else
         if (type == "5")       { icon.image = "../img/purple.png"; } else
                                { icon.image = "../img/base.png";   }
      icon.iconSize = new GSize(20,34);
 /*     icon.shadow = "./img/shadow.png";  
      icon.shadowSize = new GSize(28, 28); */
      icon.iconAnchor = new GPoint(10, 34);
      icon.infoWindowAnchor = new GPoint(15, 1);
      }

      if ( (type >= "A") && (type <= "Z")  )  {
         if (type == "A")	{ icon.image = "../img/redcircle.png";    } else	
         if (type == "B")       { icon.image = "../img/yellowcircle.png"; } else
         if (type == "C")       { icon.image = "../img/greencircle.png";  } else
         if (type == "D")       { icon.image = "../img/bluecircle.png";   } else
         if (type == "E")       { icon.image = "../img/purplecircle.png"; } else
         if (type == "F")       { icon.image = "../img/graycircle.png";   } else
         if (type == "G")       { icon.image = "../img/cyancircle.png";   } else
         if (type == "H")       { icon.image = "../img/blowncircle.png";  } else
         if (type == "I")       { icon.image = "../img/orangecircle.png"; } else
         if (type == "J")       { icon.image = "../img/blackcircle.png";  } else
         if (type == "X")       { icon.image = "../img/sbluecircle.png"; } else
         if (type == "Y")       { icon.image = "../img/whitecircle.png";  } else

         if (type == "K")	{ icon.image = "../img/redball.png";    } else	
         if (type == "L")       { icon.image = "../img/yellowball.png"; } else
         if (type == "M")       { icon.image = "../img/greenball.png";  } else
         if (type == "N")       { icon.image = "../img/blueball.png";   } else
         if (type == "O")       { icon.image = "../img/purpleball.png"; } else
         if (type == "P")       { icon.image = "../img/grayball.png";   } else
         if (type == "Q")       { icon.image = "../img/cyanball.png";   } else
         if (type == "R")       { icon.image = "../img/blownball.png";  } else
         if (type == "S")       { icon.image = "../img/orangeball.png"; } else
         if (type == "T")       { icon.image = "../img/blackball.png";  } else
         if (type == "R1")	{ icon.image = "../img/redball1.png";    } else	
         if (type == "Y1")      { icon.image = "../img/yellowball1.png"; } else
         if (type == "G1")      { icon.image = "../img/greenball1.png";  } else
         if (type == "B1")      { icon.image = "../img/blueball1.png";   } else
         if (type == "P1")      { icon.image = "../img/purpleball1.png"; } else
                                { icon.image = "../img/base.png";   }

      icon.iconSize = new GSize(20,20);
 /*     icon.shadow = "./img/shadow.png";  
      icon.shadowSize = new GSize(28, 28); */
      icon.iconAnchor = new GPoint(10, 10);
      icon.infoWindowAnchor = new GPoint(15, 1);
      }

      if ( (type >= "a") && (type <= "z")  )  {
         if (type == "a")	{ icon.image = "../img/reddot.png";    } else	
         if (type == "b")       { icon.image = "../img/yellowdot.png"; } else
         if (type == "c")       { icon.image = "../img/greendot.png";  } else
         if (type == "d")       { icon.image = "../img/bluedot.png";   } else
         if (type == "e")       { icon.image = "../img/purpledot.png"; } else
         if (type == "f")       { icon.image = "../img/graydot.png";   } else
         if (type == "g")       { icon.image = "../img/cyandot.png";   } else
         if (type == "h")       { icon.image = "../img/blowndot.png";  } else
         if (type == "i")       { icon.image = "../img/orangedot.png"; } else
         if (type == "j")       { icon.image = "../img/blackdot.png";  } else
                                { icon.image = "../img/base.png";   }

      icon.iconSize = new GSize(5,5);
 /*     icon.shadow = "./img/shadow.png";  
      icon.shadowSize = new GSize(28, 28); */
      icon.iconAnchor = new GPoint(3,2);
      icon.infoWindowAnchor = new GPoint(4, 1);
      }

      if ( type == "circ")  {

        var zoom = map.getZoom();
        var size = Math.round((contents / 50000) *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, "zoomend", function(zoomold,zoomnew) {
        setIconSize3(map,marker,icon,size*2); 
        });
      }

      if (type == "car") { 
        icon.image = "../img/car.gif"; 
        icon.iconSize = new GSize(50,22);
 /*     icon.shadow = "./img/shadow.png";  
        icon.shadowSize = new GSize(28, 28); */
        icon.iconAnchor = new GPoint(25,11);
        icon.infoWindowAnchor = new GPoint(40,12);
      }

      if (type == "truck") { 
        icon.image = "../img/truck.gif"; 
        icon.iconSize = new GSize(72,30);
 /*     icon.shadow = "./img/shadow.png";  
        icon.shadowSize = new GSize(28, 28); */
        icon.iconAnchor = new GPoint(36,15);
        icon.infoWindowAnchor = new GPoint(65, 15);
      }

      if (type == "ls") { 
        icon.image = "../img/ls.png"; 
        icon.iconSize = new GSize(26,25);
        icon.iconAnchor = new GPoint(13,12);
        icon.infoWindowAnchor = new GPoint(20, 20);
      }

      if (type == "law") { 
        icon.image = "img/ls.png"; 
        icon.iconSize = new GSize(26,25);
        icon.iconAnchor = new GPoint(13,12);
        icon.infoWindowAnchor = new GPoint(20, 20);
      }

      if (type == "geo") { 
        icon.image = "../img/geo.jpg"; 
        icon.iconSize = new GSize(27,18);
        icon.iconAnchor = new GPoint(14,9);
        icon.infoWindowAnchor = new GPoint(20, 15);
      }

      if (type == "ss") { 
        icon.image = "../img/ss.jpg"; 
        icon.iconSize = new GSize(26,26);
        icon.iconAnchor = new GPoint(13,13);
        icon.infoWindowAnchor = new GPoint(20, 20);
      }

      var options = { title: id,
                      icon : icon,
                      draggable: false,
                      bouncy: false};

      var marker = new GMarker(point, options);

      if ( link == ""  )  {
          var html = "<b>" + id + "</b><hr width=\"320\" align=\"left\" color=\"ffcccc\">" + contents + ""; } else
        { var html = "<a href=\"" + link + "\" target=\"_blank\"><b>" + id + "</b></a><hr width=\"320\" align=\"left\" color=\"ffcccc\">" + contents + ""; 
      }

/*      if ( open_flag == 1 ) {
        map.openInfoWindowHtml(point,html);
      } else {   */
        GEvent.addListener(marker, "click", function() {
        map.openInfoWindowHtml(point,html);
        });
/*      }  */

/*      return marker; */
      map.addOverlay(marker);

      if ( open_flag == 1 ) {
        GEvent.trigger(marker,"click");
      }

    }


    function setNumber(map, id, lng, lat, color, number, contents) {

 /* 数字アイコンのセット */

      var icon = new GIcon();
      var point = new GLatLng(lat, lng);

 /*     number = 10+number;
      id = 10+id; */

      if ( number > 99 ) {
         number = 100;
     /*    color = "yellow"; */
      }

      icon.image = "../img/"+color+"_"+number+".png";

      icon.iconSize = new GSize(20,20);
 /*     icon.shadow = "./img/shadow.png";  
      icon.shadowSize = new GSize(28, 28); */
      icon.iconAnchor = new GPoint(10, 10);
      icon.infoWindowAnchor = new GPoint(15, 1);

      var options = { title: id,
                      icon : icon,
                      draggable: false,
                      bouncy: false};

      var marker = new GMarker(point, options);

      var html = contents + ""; 

      GEvent.addListener(marker, "click", function() {
        map.openInfoWindowHtml(point,html);
      });

/*      return marker; */
      map.addOverlay(marker);

/*       marker manager; */
//     manager.addMarker(marker);
//     manager.refresh();
    }

    // Create a linkmarker 

    var markers = []; 
    function addlinkMarker(map, lng, lat, html) {
      var point = new GLatLng(lat, lng);
      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);
    }



/*    半径Xmの円　 */

    function setCircle(map, id, lng, lat, type, contents, link) {
      var icon = new GIcon();
      var point = new GLatLng(lat, lng);

      icon.image = "../img/redcircle100.png";
      icon.iconSize = new GSize(6,6);
      icon.iconAnchor = new GPoint(3,3);
      icon.infoWindowAnchor = new GPoint(3,1);

      var marker = new GMarker(point, icon);

      if ( link == ""  )  {
          var html = "<b>" + id + "</b><hr width=\"200\" align=\"left\" color=\"ffcccc\">" + contents + ""; } else
        { var html = "<a href=\"" + link + "\" target=\"_blank\"><b>" + id + "</b></a><hr width=\"200\" align=\"left\" color=\"ffcccc\">" + contents + ""; 
      }

      GEvent.addListener(marker, "click", function() {
      marker.openInfoWindowHtml(html);
      });

      GEvent.addListener(map, "zoomend", function(zoomold,zoomnew){
      setIconSize(map,marker,icon); 
      });

/*      return marker; */
      map.addOverlay(marker);
    }

/*  zoomにより画像サイズ変更 -----------------------------------------------*/

    function setIconSize(map,marker,icon) {
      /* zoom に対応するアイコンのセット */

      map.removeOverlay(marker);
      var zoom = map.getZoom();
      zoom = 19 - zoom;

         if (zoom == 0)	        { 
                                  icon.iconSize = new GSize(100,100);
                                  icon.iconAnchor = new GPoint(50,50);
                                  icon.infoWindowAnchor = new GPoint(50,1);
                                } else	
         if (zoom == 1)         { 
                                  icon.iconSize = new GSize(50,50);
                                  icon.iconAnchor = new GPoint(25,25);
                                  icon.infoWindowAnchor = new GPoint(25,1);
                                } else
         if (zoom == 2)         { 
                                  icon.iconSize = new GSize(25,25);
                                  icon.iconAnchor = new GPoint(13,13);
                                  icon.infoWindowAnchor = new GPoint(13,1);
                                } else
         if (zoom == 3)         { 
                                  icon.iconSize = new GSize(13,13);
                                  icon.iconAnchor = new GPoint(6,6);
                                  icon.infoWindowAnchor = new GPoint(6,1);
                                } else
         if (zoom == 4)         { 
                                  icon.iconSize = new GSize(6,6);
                                  icon.iconAnchor = new GPoint(3,3);
                                  icon.infoWindowAnchor = new GPoint(3,1);
                                } else
                                { 
                                  icon.iconSize = new GSize(6,6);
                                  icon.iconAnchor = new GPoint(3,3);
                                  icon.infoWindowAnchor = new GPoint(3,1);
                                }
      map.addOverlay(marker);

    }

/*    半径Xmの円の描画　 ----------------------------------------------------------*/

    function DrawCircle(map, id, lng, lat, type, contents, rad) {
      var icon = new GIcon();
      var point = new GLatLng(lat, lng);

      if ( rad >100 )   {  
         if (type == "A")	{ icon.image = "../img/redcircle800.png";    } else	
         if (type == "B")       { icon.image = "../img/yellowcircle800.png"; } else
         if (type == "C")       { icon.image = "../img/greencircle800.png";  } else
         if (type == "D")       { icon.image = "../img/bluecircle800.png";   } else
         if (type == "E")       { icon.image = "../img/purplecircle800.png"; } else
         if (type == "F")       { icon.image = "../img/graycircle800.png";   } else
         if (type == "G")       { icon.image = "../img/cyancircle800.png";   } else
         if (type == "H")       { icon.image = "../img/blowncircle800.png";  } else
         if (type == "I")       { icon.image = "../img/orangecircle800.png"; } else
         if (type == "J")       { icon.image = "../img/blackcircle800.png";  } else
                                { icon.image = "../img/redcircle800.png";    }
        } else { 

         if (type == "A")	{ icon.image = "../img/redcircle100.png";    } else	
         if (type == "B")       { icon.image = "../img/yellowcircle100.png"; } else
         if (type == "C")       { icon.image = "../img/greencircle100.png";  } else
         if (type == "D")       { icon.image = "../img/bluecircle100.png";   } else
         if (type == "E")       { icon.image = "../img/purplecircle100.png"; } else
         if (type == "F")       { icon.image = "../img/graycircle100.png";   } else
         if (type == "G")       { icon.image = "../img/cyancircle100.png";   } else
         if (type == "H")       { icon.image = "../img/blowncircle100.png";  } else
         if (type == "I")       { icon.image = "../img/orangecircle100.png"; } else
         if (type == "J")       { icon.image = "../img/blackcircle100.png";  } else
                                { icon.image = "../img/redcircle100.png";    }
      }  
      icon.iconSize = new GSize(6,6);
      icon.iconAnchor = new GPoint(3,3);
      icon.infoWindowAnchor = new GPoint(3,1);

      var marker = new GMarker(point, icon);
      var html = "<b>" + id + "</b><hr width=\"200\" align=\"left\" color=\"ffcccc\">" + contents + ""; 
      var dia = rad*2;

      GEvent.addListener(marker, "click", function() {
      marker.openInfoWindowHtml(html);
      });                                                       
      GEvent.addListener(map, "zoomend", function(zoomold,zoomnew) {

      setIconSize2(map,marker,icon,dia); 
      });

        GEvent.trigger(map,"zoomend");

/*      return marker; */
      map.addOverlay(marker);
    }

/*    半径Xmの円の描画　 ----------------------------------------------------------*/

    function EditCircle(map, id, lng, lat, type, contents, rad) {
      var icon = new GIcon();
      var point = new GLatLng(lat, lng);

      if ( rad >100 )   {  
         if (type == "A")	{ icon.image = "../img/redcircle800.png";    } else	
         if (type == "B")       { icon.image = "../img/yellowcircle800.png"; } else
         if (type == "C")       { icon.image = "../img/greencircle800.png";  } else
         if (type == "D")       { icon.image = "../img/bluecircle800.png";   } else
         if (type == "E")       { icon.image = "../img/purplecircle800.png"; } else
         if (type == "F")       { icon.image = "../img/graycircle800.png";   } else
         if (type == "G")       { icon.image = "../img/cyancircle800.png";   } else
         if (type == "H")       { icon.image = "../img/blowncircle800.png";  } else
         if (type == "I")       { icon.image = "../img/orangecircle800.png"; } else
         if (type == "J")       { icon.image = "../img/blackcircle800.png";  } else
                                { icon.image = "../img/redcircle800.png";    }
        } else { 

         if (type == "A")	{ icon.image = "../img/redcircle100.png";    } else	
         if (type == "B")       { icon.image = "../img/yellowcircle100.png"; } else
         if (type == "C")       { icon.image = "../img/greencircle100.png";  } else
         if (type == "D")       { icon.image = "../img/bluecircle100.png";   } else
         if (type == "E")       { icon.image = "../img/purplecircle100.png"; } else
         if (type == "F")       { icon.image = "../img/graycircle100.png";   } else
         if (type == "G")       { icon.image = "../img/cyancircle100.png";   } else
         if (type == "H")       { icon.image = "../img/blowncircle100.png";  } else
         if (type == "I")       { icon.image = "../img/orangecircle100.png"; } else
         if (type == "J")       { icon.image = "../img/blackcircle100.png";  } else
                                { icon.image = "../img/redcircle100.png";    }
      }  
/*      icon.iconSize = new GSize(6,6);
      icon.iconAnchor = new GPoint(3,3);
      icon.infoWindowAnchor = new GPoint(3,1);
*/
      dia = 1000*2;
      var zoom = map.getZoom();
      zm = 19-zoom;
      var size = Math.round(dia/Math.pow(2,zm)*2*2);
      if ( size <    4 )  { size =    4; }
      if ( size > 2000 )  { size = 2000; } 
      var center = Math.round(size/2);
      icon.iconSize = new GSize(size,size);
      icon.iconAnchor = new GPoint(center,center);
      icon.infoWindowAnchor = new GPoint(center,1);

    var marker = new GMarker(point,{
            icon       : icon,
            draggable  : true 
    });

      var html = "<b>" + id + "</b><hr width=\"200\" align=\"left\" color=\"ffcccc\">" + contents + ""; 
      var dia = rad*2;

      GEvent.addListener(marker, "click", function() {
      map.removeOverlay(marker);
      }); 

/*
      GEvent.addListener(marker, "click", function() {
      marker.openInfoWindowHtml(html);
      });  
*/  
      GEvent.addListener(map, "click", function(overlay,point) {
        type = "A";
        rad = 1000;
        createCircle(map, id, point.x, point.y, type, contents, rad); 

      });
                                                
      GEvent.addListener(map, "zoomend", function(zoomold,zoomnew) {
        setIconSize3(map,marker,icon,dia); 
      });

/*      return marker; */
      map.addOverlay(marker);
    }

/*----------------------------------------------------------------------------*/
    function setEvent(map) {    
/*      GEvent.addListener(map, "click", function(overlay,point) {

        createCircle(map, id, point.x, point.y, type, contents, rad); 
 alert(point); 
      }); */
    }

    function createCircle(map, id, lng, lat, type, contents, rad) {
      var icon = new GIcon();
      var point = new GLatLng(lat, lng);

      if ( rad >100 )   {  
         if (type == "A")	{ icon.image = "../img/redcircle800.png";    } else	
         if (type == "B")       { icon.image = "../img/yellowcircle800.png"; } else
         if (type == "C")       { icon.image = "../img/greencircle800.png";  } else
         if (type == "D")       { icon.image = "../img/bluecircle800.png";   } else
         if (type == "E")       { icon.image = "../img/purplecircle800.png"; } else
         if (type == "F")       { icon.image = "../img/graycircle800.png";   } else
         if (type == "G")       { icon.image = "../img/cyancircle800.png";   } else
         if (type == "H")       { icon.image = "../img/blowncircle800.png";  } else
         if (type == "I")       { icon.image = "../img/orangecircle800.png"; } else
         if (type == "J")       { icon.image = "../img/blackcircle800.png";  } else
                                { icon.image = "../img/redcircle800.png";    }
        } else { 

         if (type == "A")	{ icon.image = "../img/redcircle100.png";    } else	
         if (type == "B")       { icon.image = "../img/yellowcircle100.png"; } else
         if (type == "C")       { icon.image = "../img/greencircle100.png";  } else
         if (type == "D")       { icon.image = "../img/bluecircle100.png";   } else
         if (type == "E")       { icon.image = "../img/purplecircle100.png"; } else
         if (type == "F")       { icon.image = "../img/graycircle100.png";   } else
         if (type == "G")       { icon.image = "../img/cyancircle100.png";   } else
         if (type == "H")       { icon.image = "../img/blowncircle100.png";  } else
         if (type == "I")       { icon.image = "../img/orangecircle100.png"; } else
         if (type == "J")       { icon.image = "../img/blackcircle100.png";  } else
                                { icon.image = "../img/redcircle100.png";    }
      }  
/*      icon.iconSize = new GSize(6,6);
      icon.iconAnchor = new GPoint(3,3);
      icon.infoWindowAnchor = new GPoint(3,1);
*/
      dia = rad*2;
      var zoom = map.getZoom();
      zm = 19 - zoom;
      var size = Math.round(dia/Math.pow(2,zm)*2*2);
      if ( size <    4 )  { size =    4; }
      if ( size > 2000 )  { size = 2000; } 
      var center = Math.round(size/2);
      icon.iconSize = new GSize(size,size);
      icon.iconAnchor = new GPoint(center,center);
      icon.infoWindowAnchor = new GPoint(center,1);


    var marker = new GMarker(point,{
            icon       : icon,
            draggable  : true 
    });

      var html = "<b>" + id + "</b><hr width=\"200\" align=\"left\" color=\"ffcccc\">" + contents + ""; 
      var dia = rad*2;

      GEvent.addListener(marker, "click", function() {
      map.removeOverlay(marker);
      });   
                                                
      GEvent.addListener(map, "zoomend", function(zoomold,zoomnew) {
        setIconSize3(map,marker,icon,dia); 
      });

/*      return marker; */
      map.addOverlay(marker);
    }

/*  zoomにより画像サイズ変更 -------------------------------------------------------*/

    function setIconSize2(map,marker,icon,dia) {
      /* zoom に対応するアイコンのセット */

      map.removeOverlay(marker);
      var zoom = map.getZoom();
      zoom = 19 - zoom;

      var size = Math.round(dia/Math.pow(2,zoom)*2*2);
      if ( size <    4 )  { size =    4; }
      if ( size > 2000 )  { size = 2000; }  

      var center = Math.round(size/2);

      icon.iconSize = new GSize(size,size);
      icon.iconAnchor = new GPoint(center,center);
      icon.infoWindowAnchor = new GPoint(center,1);

      map.addOverlay(marker);

    }
/*  zoomにより画像サイズ変更 -------------------------------------------------------*/

    function setIconSize3(map,marker,icon,dia) {
      /* zoom に対応するアイコンのセット */

      map.removeOverlay(marker);
      var zoom = map.getZoom();
      zm = 19 - zoom;
      var size = Math.round(dia/Math.pow(2,zm)*2*2);
      if ( size <    4 )  { size =    4; }
      if ( size > 2000 )  { size = 2000; }  

      var center = Math.round(size/2);

      icon.iconSize = new GSize(size,size);
      icon.iconAnchor = new GPoint(center,center);
      icon.infoWindowAnchor = new GPoint(center,1);

      map.addOverlay(marker);

    }
/*  zoomにより画像サイズ変更 -------------------------------------------------------*/

    function setIconSize4(map,marker,icon,contents) {
      /* zoom に対応するアイコンのセット */

      map.removeOverlay(marker);
      var zoom = map.getZoom();
      var size = contents / 25000 * (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);
    }

/*    半径Xmの中抜き円の描画　 ----------------------------------------------------------*/

    function DrawCircleE(map,lng,lat) {

      GEvent.addListener(map, "zoom", function(zoomold,zoomnew) {
      var rad = 280;
      setIconSize2(map,marker,icon,rad); 
      });

      GEvent.addListener(map,"click", function(overlay, point){

      var icon = new GIcon();
      icon.image = "../img/whitecirclee.png";   
      icon.iconSize = new GSize(1,1);
      icon.iconAnchor = new GPoint(1,1);
      icon.infoWindowAnchor = new GPoint(1,1);

      var marker = new GMarker(point, icon);    
      var rad = 280;
      setIconSize2(map,marker,icon,rad); 

      });

  /*    map.addOverlay(marker); */
    }

/*    画像のオーバーレイ　 ----------------------------------------------------------*/

    function ImageOverlay(map, file, lng, lat, sizex, sizey) {
      var icon = new GIcon();
      var point = new GLatLng(lat, lng);

      icon.image = "./image/"+file;    
      icon.iconSize = new GSize(800,600);
      icon.iconAnchor = new GPoint(400,300);
      icon.infoWindowAnchor = new GPoint(3,1);

      var marker = new GMarker(point, icon);

      var dia = 800;
                                                      
      GEvent.addListener(map, "zoom", function(zoomold,zoomnew) {

      setImageSize(map,marker,icon,dia); 
      });

/*      return marker; */
      map.addOverlay(marker);
    }

/*  zoomによるオーバレイ画像サイズ変更 -------------------------------------------------------*/

    function setImageSize(map,marker,icon,dia) {
      /* zoom に対応するアイコンのセット */

      map.removeOverlay(marker);
      var zoom = map.getZoom();
      zoom = 19 - zoom;

      var size = Math.round(dia/Math.pow(2,zoom)*1.08);
      if ( size <    4 )  { size =    4; }
      if ( size > 2000 )  { size = 2000; }  

      var center = Math.round(size/2);

      icon.iconSize = new GSize(size,size*0.75);
      icon.iconAnchor = new GPoint(center,center*0.75);
      icon.infoWindowAnchor = new GPoint(center,1);

      map.addOverlay(marker);

    }

/*  自動移動--------------------------------------------------------------------------------*/

    function moveTo(map,lng,lat,html,num) {
      /* アイコンと地図を自動移動 */

      var rtn = scrollT0("map.panTo(new GLatLng(" + lat + "," + lng + "))",num*2000); 
      var rtn = scrollT0("addMarker(map,"+lng+","+lat+",'" +html+ "' );",num*2000); 

   } 

    function runTo(map,lng,lat,html,num) {
      /* アイコンと地図を高速移動 */

      var rtn = scrollT0("map.panTo(new GLatLng(" + lat + "," + lng + "))",num*500); 
      var rtn = scrollT0("addMarker(map,"+lng+","+lat+",'" +html+ "' );",num*500); 

   } 

/*アイコン表示のための関数サンプル----------------------------------------------------------*/
function seeAt(lat, lng, title, body,link, size)
    {
        var point = new GPoint(lat, lng);
        map.centerAndZoom(point, size);
        var marker = new GMarker(point);
 var html = "<a href=\"" + link + "\" target=\"_blank\"><b>" + id +
"</b></a><hr width=\"200\" align=\"left\" color=\"ffcccc\">" + contents +
"";
        map.addOverlay(marker);
 // Show this marker's index in the info window when it is clicked
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        marker.openInfoWindowHtml(html);

}

/*  Travel Diary -------------------------------------------------------------------------------- */

    function travelTO(map,id,lng,lat,type,html,link,num) { 

      /* 行程に沿って移動 */

      var rtn = scrollT0("map.panTo(new GLatLng(" + lat + "," + lng + "))",num*1000); 
      var rtn = scrollT0("setMarker(map,'"+id+"',"+lng+","+lat+",'"+type+"','" +html+ "','"+link+"' );",num*1000); 
      /* var rtn = setMarker(map,id,lng,lat,type,html,link ); */

   } 

/*  Draw Line -------------------------------------------------------------------------------- */

    function DrawLine(map,lng1,lat1,lng2,lat2) { 

    var p1 = new GLatLng(lat1,lng1);
    var p2 = new GLatLng(lat2,lng2);

    var points = [];
    points.push(p1);
    points.push(p2);

    map.addOverlay(new GPolyline(points,'#FF0000',3,0.5));

   } 

/*  Draw Line with ATTR ---------------------------------------------------------------------- */

    function DrawLineA(map,lng1,lat1,lng2,lat2,color,weight,opacity) { 

    var p1 = new GLatLng(lat1,lng1);
    var p2 = new GLatLng(lat2,lng2);

    var points = [];
    points.push(p1);
    points.push(p2);

    map.addOverlay(new GPolyline(points,color,weight,opacity));

   } 

/*  Draw Polyline ----------------------------------------------------------------------------- */

    function DrawPline(map,encoded_points,encoded_levels) { 

    var encode = new GPolyline.fromEncoded({
                  "color": "#FF0000",
                  "weight": 3,
                  "opacity":0.5,
                  "points": encoded_points,
                  "zoomFactor": 2,
                  "levels": encoded_levels,
                  "numLevels": 20
                  });  

    map.addOverlay(encode);

    //alert(encoded_points);
 
    }


/*  Draw Polyline with ATTR ------------------------------------------------------------------- */

    function DrawPlineA(map,encoded_points,encoded_levels,color,weight,opacity) { 

    var encode = new GPolyline.fromEncoded({
                  "color": color,
                  "weight": weight,
                  "opacity":opacity,
                  "points": encoded_points,
                  "zoomFactor": 2,
                  "levels": encoded_levels,
                  "numLevels": 20
                  });  

    map.addOverlay(encode);

    //alert(encoded_points);
 
    }

/*  Draw Rectangle with ATTR ---------------------------------------------------------------------- */

    function DrawRect(map,lon1,lat1,lon2,lat2,color,weight,opacity,fcolor,fopacity,option) { 

    var p1 = new GLatLng(lat1,lon1);
    var p2 = new GLatLng(lat1,lon2);
    var p3 = new GLatLng(lat2,lon2);
    var p4 = new GLatLng(lat2,lon1);
    var p5 = new GLatLng(lat1,lon1);

    var points = [];
    points.push(p1);
    points.push(p2);
    points.push(p3);
    points.push(p4);
    points.push(p5);

    map.addOverlay(new GPolygon(points,color,weight,opacity,fcolor,fopacity,option));

   } 
/*  Draw Polygon with ATTR ------------------------------------------------------------------- */

    function DrawPolygon(map,encoded_points,encoded_levels,color,weight,opacity,fill,fcolor,fopacity,outline,html) { 

    var encode = new GPolygon.fromEncoded({
                 "polylines": [{
                    "color": color,
                    "weight": weight,
                    "opacity":opacity,
                    "points": encoded_points,
                    "zoomFactor": 2,
                    "levels": encoded_levels,
                    "numLevels": 20
                  }], 
                  "fill": fill,
                  "color": fcolor,
                  "opacity":fopacity,
                  "outline":outline
                  });  

    map.addOverlay(encode);

    GEvent.addListener(encode, "click", function() {
      alert(html);
//      encode.openInfoWindowHtml(html);
    }); 
 
    }


    function showAddress(address) {
      geocoder.getLatLng(
        address,
        function(point) {
          if (!point) {
            alert(address + " NOT FOUND");
          } else {
            map.setCenter(point, 12);
            }
        }
      );
    }

    // チェックボックス
    function myCheck(){
      var cnt = 0;
      var str = "";
      for (i=0 ; i < parent.checkForm.length-1 ; i++){
        if (parent.checkForm.elements[i].checked == true){
          cnt++;
          str += "filename"+cnt+"="+parent.checkForm.elements[i].value+"&";
        }
      }
      str = str.substring(0,str.length-1);
      location.href = "mapviewer_cafe.cgi?"+str;
    }

    // ラベル描画
    function drawLabel(id,content,lon,lat){

      var content = '<div style="white-space: nowrap; color: black; background-color: white">'+content;

      var label = new TLabel();
      label.id = id;
      label.anchorLatLng = new GLatLng (lat,lon);
      label.anchorPoint = 'center';
      label.content = content;
      label.percentOpacity = 100;

      map.addTLabel(label);

    }

    function drawMeshNO(num,lon,lat){

      var content = '<div style="white-space: nowrap; color: black; background-color: white">'+num;

      var label = new TLabel();
      label.id = "N"+num;
      label.anchorLatLng = new GLatLng (lat,lon);
      label.anchorPoint = 'bottomLeft';
      label.content = content;
      label.percentOpacity = 100;

      map.addTLabel(label);

    }

function TLabel(){}
TLabel.prototype.initialize=function(a){
 this.parentMap=a;
 var b=document.createElement('span');
 b.setAttribute('id',this.id);
 b.innerHTML=this.content;
 document.body.appendChild(b);
 b.style.position='absolute';
 b.style.zIndex=1;
 if(this.percentOpacity){this.setOpacity(this.percentOpacity);}
 this.w = document.getElementById(this.id).offsetWidth;
 this.h = document.getElementById(this.id).offsetHeight;
 this.mapTray=a.getPane(G_MAP_MAP_PANE);
 this.mapTray.appendChild(b);
 if(!this.markerOffset){this.markerOffset=new GSize(0,0);}
 this.setPosition();
 GEvent.bind(a,"zoomend",this,function(){this.setPosition()});
 GEvent.bind(a,"moveend",this,function(){this.setPosition()});
}
TLabel.prototype.setPosition=function(a){
 if(a){this.anchorLatLng=a;}
 var b=this.parentMap.fromLatLngToDivPixel(this.anchorLatLng);
 var x=parseInt(b.x);
 var y=parseInt(b.y);
 with(Math){switch(this.anchorPoint){
  case 'topLeft':break;
  case 'topCenter':x-=floor(this.w/2);break;
  case 'topRight':x-=this.w;break;
  case 'midRight':x-=this.w;y-=floor(this.h/2);break;
  case 'bottomRight':x-=this.w;y-=this.h;break;
  case 'bottomCenter':x-=floor(this.w/2);y-=this.h;break;
  case 'bottomLeft':y-=this.h;break;
  case 'midLeft':y-=floor(this.h/2);break;
  case 'center':x-=floor(this.w/2);y-=floor(this.h/2);break;
  default:break;
 }}
 var d=document.getElementById(this.id);
 d.style.left=x-this.markerOffset.width+'px';
 d.style.top=y-this.markerOffset.height+'px';
}
TLabel.prototype.setOpacity=function(b){
 if(b<0){b=0;} if(b>100){b=100;}
 var c=b/100;
 var d=document.getElementById(this.id);
 if(typeof(d.style.filter)=='string'){d.style.filter='alpha(opacity:'+b+')';}
 if(typeof(d.style.KHTMLOpacity)=='string'){d.style.KHTMLOpacity=c;}
 if(typeof(d.style.MozOpacity)=='string'){d.style.MozOpacity=c;}
 if(typeof(d.style.opacity)=='string'){d.style.opacity=c;}
}
GMap2.prototype.addTLabel=function(a){
 a.initialize(this);
}
GMap2.prototype.removeTLabel=function(a){
 var b=document.getElementById(a.id);
 this.getPane(G_MAP_MAP_PANE).removeChild(b);
 delete(b);
}

