var map;function createMarker(point, baseIcon, index, html) {var icono = new GIcon(baseIcon);icono.shadow = "http://d.tiempo.hvimg.com/img/shadow.png";icono.image = "http://d.tiempo.hvimg.com/img/" + index + ".png";markerOptions = { icon:icono };var marker = new GMarker(point, markerOptions);GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});return marker;}function chinchetasCercanas(doc, flagZoom){var xmlDoc = GXml.parse(doc);var markers = xmlDoc.getElementsByTagName("marker");map.clearOverlays();for (var i = 0; i < markers.length; i++) {var lat = parseFloat(markers[i].getAttribute("lat"));var lng = parseFloat(markers[i].getAttribute("lng"));var point = new GLatLng(lat,lng);var indice = markers[i].getAttribute("name");var html = GXml.value(markers[i].getElementsByTagName("html")[0]);var baseIcon = new GIcon(G_DEFAULT_ICON);baseIcon.iconSize = new GSize(35, 35);var marker = createMarker(point,baseIcon,indice,html);map.addOverlay(marker);}}function initialize(){if (GBrowserIsCompatible()) {map = new GMap2(document.getElementById("mapa"));map.setCenter(new GLatLng(-18, 152), 4, G_PHYSICAL_MAP);map.setUIToDefault();map.enableDoubleClickZoom();map.disableScrollWheelZoom();}GEvent.addListener(map, "dragend", function() {var center = map.getCenter();var coor= map.getBounds();url = "/mapajax.phtml?id=arrastrar&coor="+coor;GDownloadUrl(url, function(doc, responseCode) {if(responseCode == 200) {chinchetasCercanas(doc,0);}});});GEvent.addListener(map, "zoomend", function (){var center = map.getCenter();var coor= map.getBounds();url = "/mapajax.phtml?id=arrastrar&coor="+coor;GDownloadUrl(url, function(doc, responseCode) {if(responseCode == 200) {chinchetasCercanas(doc,0);}});});var baseIcon = new GIcon(G_DEFAULT_ICON);baseIcon.iconSize = new GSize(35, 35);var latlng = new GLatLng(10.0167, -84.2167);map.addOverlay(createMarker(latlng, baseIcon, '29', 'Alajuela
| Domingo 5 |  | Máx.:33ºC / Mín.: 21ºC |
| Lunes 6 |  | Máx.:33ºC / Mín.: 23ºC |
| Martes 7 |  | Máx.:33ºC / Mín.: 23ºC |
| Miércoles 8 |  | Máx.:32ºC / Mín.: 23ºC |
| Jueves 9 |  | Máx.:32ºC / Mín.: 23ºC |
'));var latlng = new GLatLng(10.6333, -85.4333);map.addOverlay(createMarker(latlng, baseIcon, '30', 'Liberia| Domingo 5 |  | Máx.:34ºC / Mín.: 21ºC |
| Lunes 6 |  | Máx.:34ºC / Mín.: 23ºC |
| Martes 7 |  | Máx.:33ºC / Mín.: 23ºC |
| Miércoles 8 |  | Máx.:33ºC / Mín.: 24ºC |
| Jueves 9 |  | Máx.:33ºC / Mín.: 23ºC |
'));var latlng = new GLatLng(0, 0);map.addOverlay(createMarker(latlng, baseIcon, '39', 'Puerto Limón| Domingo 5 |  | Máx.:28ºC / Mín.: 21ºC |
| Lunes 6 |  | Máx.:28ºC / Mín.: 21ºC |
| Martes 7 |  | Máx.:28ºC / Mín.: 21ºC |
| Miércoles 8 |  | Máx.:27ºC / Mín.: 22ºC |
| Jueves 9 |  | Máx.:27ºC / Mín.: 21ºC |
'));var latlng = new GLatLng(9.96667, -84.8333);map.addOverlay(createMarker(latlng, baseIcon, '28', 'Puntarenas| Domingo 5 |  | Máx.:34ºC / Mín.: 22ºC |
| Lunes 6 |  | Máx.:35ºC / Mín.: 25ºC |
| Martes 7 |  | Máx.:35ºC / Mín.: 25ºC |
| Miércoles 8 |  | Máx.:34ºC / Mín.: 25ºC |
| Jueves 9 |  | Máx.:33ºC / Mín.: 25ºC |
'));var latlng = new GLatLng(10, -84.22);map.addOverlay(createMarker(latlng, baseIcon, '30', 'San José| Domingo 5 |  | Máx.:26ºC / Mín.: 14ºC |
| Lunes 6 |  | Máx.:26ºC / Mín.: 16ºC |
| Martes 7 |  | Máx.:27ºC / Mín.: 16ºC |
| Miércoles 8 |  | Máx.:26ºC / Mín.: 16ºC |
| Jueves 9 |  | Máx.:26ºC / Mín.: 16ºC |
'));}