function loadMap(lat, lng) { if(GBrowserIsCompatible()){ var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.setCenter(new GLatLng(lat, lng), 13); var icon = new GIcon(); icon.image = "http://www.ryvenco.com/images/map/mm_20_red.png"; icon.shadow = "http://www.ryvenco.com/images/map/mm_20_shadow.png"; icon.iconSize = new GSize(12, 20); icon.shadowSize = new GSize(22, 20); icon.iconAnchor = new GPoint(6, 20); icon.infoWindowAnchor = new GPoint(5, 1); map.addOverlay(new GMarker(new GLatLng(lat, lng))); map.addControl(new TextMapControl()); } } // A TextualZoomControl is a GControl that displays textual "Zoom In" // and "Zoom Out" buttons (as opposed to the iconic buttons used in // Google Maps). function TextMapControl() { } TextMapControl.prototype = new GControl(); // Creates a one DIV for each of the buttons and places them in a container // DIV which is returned as our control element. We add the control to // to the map container and return the element for the map class to // position properly. TextMapControl.prototype.initialize = function(map) { var container = document.createElement("div"); container.style.padding = "2px"; var normalButton = document.createElement("div"); this.setButtonStyle_(normalButton); container.appendChild(normalButton); normalButton.appendChild(document.createTextNode("Normal")); GEvent.addDomListener(normalButton, "click", function() { map.setMapType(G_NORMAL_MAP); }); var hypridButton = document.createElement("div"); this.setButtonStyle_(hypridButton); container.appendChild(hypridButton); hypridButton.appendChild(document.createTextNode("Hybrid")); GEvent.addDomListener(hypridButton, "click", function() { map.setMapType(G_HYBRID_MAP); }); map.getContainer().appendChild(container); return container; } // By default, the control will appear in the top left corner of the // map with 7 pixels of padding. TextMapControl.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(2, 4)); } // Sets the proper CSS for the given button element. TextMapControl.prototype.setButtonStyle_ = function(button) { button.style.textDecoration = "none"; button.style.color = "black"; button.style.backgroundColor = "white"; button.style.font = "small Arial"; button.style.border = "1px solid black"; button.style.padding = "2px"; button.style.margin = "2px"; button.style.textAlign = "center"; button.style.width = "4em"; button.style.cursor = "pointer"; button.style.display = "inline"; }