var aOptionPairs = new Array() 
var map = null;
var geocoder = null;

function makefill(nolecce) {

if (nolecce=='True') { 

jsrsExecute( 'select-map.asp', load, 'makelist', comune );
}else{
mappa2(comune);
}
 function cbFillMake ( strMakes ){ 
alert(strMakes);
 aOptionPairs = strMakes.split('|');
alert(aOptionPairs[0]+'aaa');
  }
  }


function load(strMakes) {


 aOptionPairs = strMakes.split('|');



        if (GBrowserIsCompatible()) { 
   //var hotIcon = new GIcon();
      //hotIcon.image = "http://www.ideasalento.com/images/flag2.gif";
     // hotIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
     // hotIcon.iconSize = new GSize(20, 34);
     // hotIcon.shadowSize = new GSize(37, 34);
     // hotIcon.iconAnchor = new GPoint(9, 34);
     // hotIcon.infoWindowAnchor = new GPoint(9, 2);
     // hotIcon.infoShadowAnchor = new GPoint(18, 25);
 



   
      function createMarker(point,html) {
        //var marker = new GMarker(point,hotIcon);
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }    
    


      if (GBrowserIsCompatible()) {

        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());

        map.setCenter(new GLatLng(aOptionPairs[1], aOptionPairs[0]), 11);
     
      var point = new GLatLng(aOptionPairs[1],aOptionPairs[0]);





//var marker = createMarker(point,'prova')
var marker = createMarker(point,aOptionPairs[2])
      map.addOverlay(marker);
      }
      
    }
    
    // display a warning if the browser was not compatible
    else {
      alert("Ci dispiace ma Google maps non è compatibile con questo Browser");
    }
          


    }


function mappa2(comune) {

 if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(40.727356,13.909893), 8);
geocoder = new GClientGeocoder();
showAddress(comune);
}
}


function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 10);
var marker = new GMarker(point);
map.addOverlay(marker);
//marker.openInfoWindowHtml(address);
}
}
);
}
}
          



