var mapactive = false; var map; function toggleMap() { if (!mapactive) { // First click, display div, put "loading" anigif and then initialize $('div#map_canvas').show(); initialize(); var latlong = new GLatLng(12.879721,121.774017); createMarker(latlong,'5','','','') } else { // Not first click, just show or hide TODO: change the INNER HTML of the href to show map/hide map $('div#map_canvas').slideToggle("fast"); } } function initialize() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(12.879721,121.774017), 5); map.addControl(new GMapTypeControl()); map.addControl(new GSmallMapControl()) var geocoder = new GClientGeocoder(); var icon = new GIcon(); icon.image = 'http://google.webassist.com/google/markers/star/pacifica.png'; icon.shadow = 'http://google.webassist.com/google/markers/star/shadow.png'; icon.iconSize = new GSize(29,39); icon.shadowSize = new GSize(29,39); icon.iconAnchor = new GPoint(15,15); icon.infoWindowAnchor = new GPoint(19,7); icon.printImage = 'http://google.webassist.com/google/markers/star/pacifica.gif'; icon.mozPrintImage = 'http://google.webassist.com/google/markers/star/pacifica_mozprint.png'; icon.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif'; icon.transparent = 'http://google.webassist.com/google/markers/star/pacifica_transparent.png'; } mapactive = true; } function createMarker(latlng,dzoom, name,title,url) { map.addOverlay(new GMarker(latlng)); map.setCenter(latlng,dzoom); }