var map = null;
var geocoder = null;

function showAddress(address) {

    //verifica se il browser supporta il servizio google map
    if (GBrowserIsCompatible()) {
        geocoder = new GClientGeocoder();
        //var address = document.getElementById('strAddress').innerHTML;
        //var address = '23 PASTORIE TEOLO';
        if (geocoder) {
            geocoder.getLatLng(
                    address,
                    function(point) {
                        //se il punto non è localizzato sulla mappa
                        if (!point) {
                           // document.getElementById('map_container').style.display = 'none';
                           // document.getElementById('bttOpenMap').style.display = '';

                            alert('Indirizzo non visualizzabile');
                            window.scrollTo(0, 0);
                        } else {
                            //document.getElementById('map_container').style.display = '';
                            //document.getElementById('bttOpenMap').style.display = 'none';
                            //se la mappa non è mai stata caricata prima nella pagina la carica ora
                            if (!map) {
                                map = new GMap2(document.getElementById("map"));
                               map.addControl(new GSmallMapControl());
                               /* map.addControl(new GOverviewMapControl(),
                                    new GControlPosition(G_ANCHOR_BOTTOM_RIGHT));*/
                               // map.addControl(new GMapTypeControl());
                            }

                           
                          

                            map.setCenter(point, 15);

                            var marker = new GMarker(point);
                            map.addOverlay(marker);
                           
                        }
                    }
                );
        }
      
    }
}

