Your blog is really good....i tried embedding it in my page but it
doesnt work...Its not showing anything....What I want is 8 results
should be displayed on a page and if there are more they should be in
pages....so that if user wants he can click on the page and see more
results as of now this is my code---if could could help me solve this
problem it will be great---


function OnLoad() {
      gSmallIcon = new google.maps.Icon();
      gSmallIcon.image = "http://labs.google.com/ridefinder/images/
mm_20_yellow.png";
      gSmallIcon.shadow = "http://labs.google.com/ridefinder/images/
mm_20_shadow.png";
      gSmallIcon.iconSize = new google.maps.Size(12, 20);
      gSmallIcon.shadowSize = new google.maps.Size(22, 20);
      gSmallIcon.iconAnchor = new google.maps.Point(6, 20);
      gSmallIcon.infoWindowAnchor = new google.maps.Point(5, 1);


      gSearchForm = new google.search.SearchForm(false,
document.getElementById("searchform"));
      gSearchForm.setOnSubmitCallback(null, CaptureForm);
      gSearchForm.input.focus();

      // Initialize the map
      gMap = new google.maps.Map2(document.getElementById("map"));
      gMap.addControl(new google.maps.SmallMapControl());
      gMap.addControl(new google.maps.MapTypeControl());
      gMap.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);

      // Initialize the local searcher
      gLocalSearch = new google.search.LocalSearch();


 
gLocalSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);

      gLocalSearch.setCenterPoint(gMap);
      gLocalSearch.setSearchCompleteCallback(null, OnLocalSearch);

      // Execute the initial search
      //gSearchForm.execute("italian restaurants");

    }

    // Called when Local Search results are returned, we clear the old
    // results and load the new ones.
    function OnLocalSearch() {
      if (!gLocalSearch.results) return;
      var searchWell = document.getElementById("searchwell");

      // Clear the map and the old search well
      searchWell.innerHTML = "";
      var cursor = this.cursor;
      if(!this.allResults || cursor.currentPageIndex==0)
{this.allResults = [];}

      this.allResults = this.allResults.concat(this.results);

      if (cursor && cursor.pages.length>cursor.currentPageIndex+1){

// Go to the next page.
this.gotoPage(cursor.currentPageIndex+1);

// Else, if there is no cursor object or we're on the last page...
} else {

// Loop through the results and...
for(var i=0; i<this.allResults.length; i++){
var result = this.allResults[i];

 for (var i = 0; i < gCurrentResults.length; i++) {
        if (!gCurrentResults[i].selected()) {
          gMap.removeOverlay(gCurrentResults[i].marker());
        }
      }

 gCurrentResults = [];
      for (var i = 0; i < gLocalSearch.results.length; i++) {
        gCurrentResults.push(new LocalResult(result));
      }


}





      var attribution = gLocalSearch.getAttribution();
      if (attribution) {
 
document.getElementById("searchwell").appendChild(attribution);
      }

      // move the map to the first result
      var first = gLocalSearch.results[0];
      gMap.panTo(new google.maps.LatLng(first.lat, first.lng));
    }

    // Cancel the form submission, executing an AJAX Search API
search.

    function CaptureForm(searchForm) {
    var wifisearch= "wifi"+" "+searchForm.input.value;
      gLocalSearch.execute(wifisearch);
      return false;
    }



    // A class representing a single Local Search result returned by
the
    // Google AJAX Search API.
- Show quoted text -

    function LocalResult(result) {
      this.result_ = result;
      this.resultNode_ = this.unselectedHtml();
 
document.getElementById("searchwell").appendChild(this.resultNode_);
      gMap.addOverlay(this.marker(gSmallIcon));
    }

    // Returns the GMap marker for this result, creating it with the
given
    // icon if it has not already been created.
    LocalResult.prototype.marker = function(opt_icon) {
      if (this.marker_) return this.marker_;
      var marker = new google.maps.Marker(new
google.maps.LatLng(parseFloat(this.result_.lat),
 
parseFloat(this.result_.lng)),
                               opt_icon);
      GEvent.bind(marker, "click", this, function() {
        marker.openInfoWindow(this.selected() ? this.selectedHtml() :
 
this.unselectedHtml());
      });
      this.marker_ = marker;
      return marker;
    }

    // "Saves" this result if it has not already been saved
    LocalResult.prototype.select = function() {
      if (!this.selected()) {
        this.selected_ = true;

        // Remove the old marker and add the new marker
        gMap.removeOverlay(this.marker());
        this.marker_ = null;
        gMap.addOverlay(this.marker(G_DEFAULT_ICON));

        // Add our result to the saved set
 
document.getElementById("selected").appendChild(this.selectedHtml());

        // Remove the old search result from the search well
        this.resultNode_.parentNode.removeChild(this.resultNode_);
      }
    }

    // Returns the HTML we display for a result before it has been
"saved"
    LocalResult.prototype.unselectedHtml = function() {
      var container = document.createElement("div");
      container.className = "unselected";
      container.appendChild(this.result_.html.cloneNode(true));
      var saveDiv = document.createElement("div");
      saveDiv.className = "select";
      //saveDiv.innerHTML = "Save this location";
      GEvent.bindDom(saveDiv, "click", this, function() {
        gMap.closeInfoWindow();
        this.select();
        gSelectedResults.push(this);
      });
      container.appendChild(saveDiv);
      return container;
    }

    // Returns the HTML we display for a result after it has been
"saved"
    LocalResult.prototype.selectedHtml = function() {
      return this.result_.html.cloneNode(true);
    }

    // Returns true if this result is currently "saved"
    LocalResult.prototype.selected = function() {
      return this.selected_;
    }

    google.setOnLoadCallback(OnLoad, true);



Thanks in advance!.It really nice of you to help all novice developers
like me!

-- 
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-ajax-search-api?hl=en.

Reply via email to