function MappaMessaggi() {
    this.loaded = false;
    
    this.init = function() {
        if (GBrowserIsCompatible()) {
            this.map = new GMap2(document.getElementById("mappaHP"),
                {backgroundColor: "#d6e7ef"});
            
            this.map.setMapType(G_PHYSICAL_MAP);
            
            this.map.setCenter(new GLatLng(41.895466,12.482324), 5);
            
            this.map.disableDragging();
            this.map.disableDoubleClickZoom();
            this.map.disableContinuousZoom();
            this.map.disableGoogleBar();
            this.map.disableScrollWheelZoom();
            this.map.disablePinchToZoom();

            this.loaded = true;
            
            this.loadMessaggio();
        }
    };
    
    this.loadMessaggio = function() {
        var ts = new Date();
        $.getJSON("messaggio.php?ts="+ts.getTime(), window.mappa.handlerMessaggio);
    };
    
    this.handlerMessaggio = function(data) {
        window.mappa.drawMarker(data);
    };
    
    this.drawMarker = function(obj) {
        
        this.map.clearOverlays();
        var point = new GLatLng(obj.lat, obj.lng);
        var marker = new GMarker(point);
        var content = "<div style='position:relative; width:260px;height:110px;padding:4px;overflow:auto;'><img src='squelettes/images/guantoinfowindow.jpg' style='float:right;' /><div style='font-weight:bold;padding-bottom:10px;'>" + obj.nome + ", " + obj.citta + "</div><div style='font-size:90%'>" + obj.messaggio + "</div></div>"         
        var infoWinOpt = {noCloseOnClick:true};
        var infoWindow = this.map.openInfoWindowHtml(point,content,infoWinOpt);
        this.map.addOverlay( marker );
        this.timer = window.setTimeout("window.mappa.loadMessaggio()", 8000);

    };

}