Skip to content

Instantly share code, notes, and snippets.

@carmelyne
Created March 18, 2009 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carmelyne/81324 to your computer and use it in GitHub Desktop.
Save carmelyne/81324 to your computer and use it in GitHub Desktop.
<!-- place in <head> -->
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAZFJWpftMwgnCCqt4vPRS7BR1HFqmY0hOxpFWSoKSv_ILnU21AhRd8Ow1u23lsYZWN5Fo-iaQ72-icQ" type="text/javascript"></script>
<!-- place in <head> or inside <body> -->
<script language="Javascript" type="text/javascript">
//<![CDATA[
function OnLoad() {
// create a search control
var searchControl = new GSearchControl();
// create a draw options object so that we
// can position the search form root
var options = new GdrawOptions();
options.setSearchFormRoot(document.getElementById("searchForm"));
// populate with searchers
searchControl.addSearcher(new GwebSearch());
searchControl.addSearcher(new GvideoSearch());
searchControl.addSearcher(new GblogSearch());
// site restricted web search with custom label
// and class suffix
var siteSearch = new GwebSearch();
siteSearch.setUserDefinedLabel("Amazon.com");
siteSearch.setUserDefinedClassSuffix("siteSearch");
siteSearch.setSiteRestriction("amazon.com");
searchControl.addSearcher(siteSearch);
searchControl.draw(document.getElementById("searchResults"), options);
searchControl.execute("");
}
GSearch.setOnLoadCallback(OnLoad);
//]]>
</script>
<!-- the div where the map will be displayed -->
<div id="map" style="width: 605px; height: 325px; margin-left:10px;"></div>
<!-- End div where the map will be displayed -->
<!-- handles markers -->
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(41.883856,-87.624958), 15);
// Our info window content
var infoTabs = [
new GInfoWindowTab("HTML text possible inside quotes"),
new GInfoWindowTab("Location", "<br /><strong><a href='#' class='red'>Chicago Cultural Center </a></strong><br /> 78 E. Washington St. <br />Chicago IL 60602 <br/><br/><a href='http://maps.google.com/maps?saddr=&daddr= 78 E. Washington St.,Chicago,IL,60602' target ='_blank' class='blue'>Get directions via Google</a>")
];
// Place a marker in the center of the map and open the info window
// automatically
var marker = new GMarker(map.getCenter());
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowTabsHtml(infoTabs);
});
map.addOverlay(marker);
marker.openInfoWindowTabsHtml(infoTabs);
}
//]]>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment