var map;
    var geocoder;
var cm_str;
var newImg_src ;
var param_adr ;
var newImg_src ;
    function initialize() {
      map = new GMap2(document.getElementById("map_canvas"));
      map.setMapType(G_PHYSICAL_MAP);
      map.setCenter(new GLatLng(38.203655,139.658203), 5);
     //   map.addControl(new GLargeMapControl());
     //   map.addControl(new GMapTypeControl());
	map.setUIToDefault();
      map.addControl(new GOverviewMapControl(new GSize(140,140)));

      geocoder = new GClientGeocoder();
      param_adr = "富士山";
	}
    // addAddressToMap() is called when the geocoder returns an
    // answer.  It adds a marker to the map with an open info window
    // showing the nicely formatted version of the address and the country code.
    function addAddressToMap(response) {
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("住所の場所を特定できませんでした。");
	      } 
	else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        marker = new GMarker(point);
        map.addOverlay(marker);
	GEvent.addListener(map, "infowindowopen", function(){
        //	var smallmap = new GMap2(document.getElementById("in_img"));
    	//	smallmap.setCenter(new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]), 9);
document.createElement('content');new se();
		});


//	marker.maxWidth(80);
         var html = '<div style="width:170px; padding-right:10px;">' + '' + '<div id="content" style="height:100px;width:150px"></div><p>マーカをクリックして詳細地図を見てみよう！</p></div>';

        marker.openInfoWindowHtml(place.address +  html);
    google.setOnLoadCallback(OnLoad);

        //  '<b>国コード:</b> ' + place.AddressDetails.Country.CountryNameCode);
 	GEvent.addListener(marker,"click",function(){map.setCenter(point, 13)
      })
    }
}
       // showLocation() is called when you click on the Search button
    // in the form.  It geocodes the address entered into the form
    // and adds a marker to the map at that location.
    function showLocation(address) {initialize();
      var xaddress = address;
	param_adr = address;
      geocoder.getLocations(xaddress, addAddressToMap);
    }

   // findLocation() is used to enter the sample addresses into the form.
    function findLocation(address) {
      document.forms[0].q.value = address;
      showLocation();
    }

    /*
    *  How to search for images and restrict them by size.
    *  This demo will also show how to use Raw Searchers, aka a searcher that is
    *  not attached to a SearchControl.  Thus, we will handle and draw the results
    *  manually.
    */
    
    function searchComplete(searcher) {
      // Check that we got results
      if (searcher.results && searcher.results.length > 0) {
        // Grab our content div, clear it.
        var contentDiv = document.getElementById('content');
        contentDiv.innerHTML = '';
    
        // Loop through our results, printing them to the page.
        var results = searcher.results;
    //    for (var i = 0; i < results.length; i++) {
        for (var i = 0; i < 1; i++) {

          // For each result write it's title and image to the screen
          var result = results[i];
          var imgContainer = document.createElement('div id="content"');
    
          var title = document.createElement('h4');
          // We use titleNoFormatting so that no HTML tags are left in the title
          title.innerHTML = result.titleNoFormatting;
    
          var newImg = document.createElement('img');
          // There is also a result.url property which has the escaped version
          newImg.src = result.tbUrl;
          newImg_src = result.tbUrl;
  
      //    imgContainer.appendChild(title);
          imgContainer.appendChild(newImg);
    
          // Put our title + image in the content
          contentDiv.appendChild(imgContainer);

        }
      }
    }
    
    function OnLoad() {
     new se();
    }

      function se() {

      // Our ImageSearch instance.
      var imageSearch = new google.search.ImageSearch();
    
      // Restrict to extra large images only
      imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
                                 google.search.ImageSearch.IMAGESIZE_MEDIUM);
    
      // Here we set a callback so that anytime a search is executed, it will call
      // the searchComplete function and pass it our ImageSearch searcher.
      // When a search completes, our ImageSearch object is automatically
      // populated with the results.
      imageSearch.setSearchCompleteCallback(this, searchComplete, [imageSearch]);
    
      // Find me a beautiful car.
      imageSearch.execute(param_adr);
}
  google.load('search', '1');
