var map;
var gdir;
var geocoder = null;
var addressMarker;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(40.951578,14.49129), 8);
var myIcon = new GIcon();
myIcon.image = 'http://www.vulcanobuono.it/templates/nj_template/images/markers/image.png';
myIcon.shadow = 'http://www.vulcanobuono.it/templates/nj_template/images/markers/shadow.png';
myIcon.iconSize = new GSize(24,29);
myIcon.shadowSize = new GSize(39,29);
myIcon.iconAnchor = new GPoint(12,29);
myIcon.infoWindowAnchor = new GPoint(12,0);
myIcon.printImage = 'http://www.vulcanobuono.it/templates/nj_template/images/markers/printImage.gif';
myIcon.mozPrintImage = 'http://www.vulcanobuono.it/templates/nj_template/images/markers/mozPrintImage.gif';
myIcon.printShadow = 'http://www.vulcanobuono.it/templates/nj_template/images/markers/printShadow.gif';
myIcon.transparent = 'http://www.vulcanobuono.it/templates/nj_template/images/markers/transparent.png';
myIcon.imageMap = [29,0,32,1,34,2,36,3,38,4,39,5,40,6,41,7,42,8,43,9,43,10,44,11,45,12,45,13,45,14,46,15,46,16,47,17,47,18,47,19,47,20,47,21,47,22,47,23,47,24,47,25,47,26,47,27,47,28,47,29,47,30,46,31,46,32,46,33,45,34,45,35,44,36,43,37,43,38,42,39,41,40,40,41,39,42,38,43,36,44,34,45,32,46,29,47,18,47,15,46,13,45,11,44,9,43,8,42,7,41,6,40,5,39,4,38,4,37,3,36,2,35,2,34,1,33,1,32,1,31,0,30,0,29,0,28,0,27,0,26,0,25,0,24,0,23,0,22,0,21,0,20,0,19,0,18,1,17,1,16,1,15,2,14,2,13,2,12,3,11,4,10,4,9,5,8,6,7,7,6,8,5,9,4,11,3,13,2,15,1,18,0];
var marker = new GMarker(new GLatLng(40.951578,14.49129), {icon:myIcon})
map.addOverlay(marker);
marker.openInfoWindowHtml("il Vulcano Buono
località boscofangone
80035 nola (na)");
gdir = new GDirections(map, document.getElementById("directions"));
GEvent.addListener(gdir, "error", handleErrors);
}
}
function setDirections(fromAddress) {
locale="it";
gdir.load("from: " + fromAddress + " to: località boscofangone 80035 nola (na)");
}
function handleErrors(){
if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
alert("Indirizzo non trovato");
else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
alert("Si è verificato un errore nella geocodifica degli indirizzi");
else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
alert("Manca un parametro");
else if (gdir.getStatus().code == G_GEO_BAD_KEY)
alert("Errore nella Key Api.");
else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
alert("La richiesta non puo' essere correttamente risolta.");
else alert("Si è verificato un errore");
}