// JScript File
google.load("search", "1");

    //To roundOff the Number to decimal places
    function roundNumber(num, dec) 
    {
	    var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	    return result;
    }
    
    function OnLoad(address) 
    {
    // Create a search control
      var searchControl = new google.search.SearchControl();

      // Add in local search
      var localSearch = new google.search.LocalSearch();
      var options = new google.search.SearcherOptions();
      options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
      searchControl.addSearcher(localSearch, options);
      
      // Set the Local Search center point
      localSearch.setCenterPoint(address);
      
        //localSearch.setCenterPoint(new GLatLng(latitude,longitude));
        
      // Tell the searcher to draw itself and tell it where to attach
      searchControl.draw(document.getElementById("searchcontrol"));

      // Execute an inital search
      searchControl.execute("Bus Stop");

        // Declare function for using results
	  searchControl.setSearchCompleteCallback(this, gotResults);

    }
    
    function gotResults(sc, searcher)
	{
		var resultcontent = '';
		//var resultdiv = document.getElementById('searchresults');
		
		for (i=0; i<searcher.results.length; i++)
		{
			var result = searcher.results[i];
			resultcontent = result.title+','+result.streetAddress+',' +result.city;
			//googleResults.push(resultcontent);
			//alert(resultcontent);
			searcher.results.length = 0;
			//return resultcontent;
		}
		//resultdiv.innerHTML = resultcontent;
	}

