(function() {
  var init;
  google.load("maps", "3.6", {
    other_params: "sensor=true"
  });
  init = function() {
    var infoWindow, kmlClick, kmlLayer, kmlOpt, kmlUrl, latlng, mapOptions, myMap, nocache;
    latlng = new google.maps.LatLng(42,12.546387);
    mapOptions = {
      center: latlng,
      zoom: 6,
      mapTypeId: google.maps.MapTypeId.SATELLITE
    };
    myMap = new google.maps.Map(document.getElementById("map"), mapOptions);
    infoWindow = new google.maps.InfoWindow({
      maxWidth: "300px",
      zIndex: 1000
    });
    nocache = "/nocache=" + (new Date()).valueOf();
    kmlUrl = "http://casecoloniche.net/kml/index.xml" + nocache;
    kmlOpt = {
      map: myMap,
      preserveViewport: true,
      suppressInfoWindows: true
    };
    kmlLayer = new google.maps.KmlLayer(kmlUrl, kmlOpt);
    kmlClick = function(kmlEvent) {
      var desc, html, title;
      title = kmlEvent.featureData.name;
      desc = kmlEvent.featureData.description.replace(/_blank/gi, "_self");
      html = '<div id="infoWindow"><h1>' + title + '</h1>' + desc + '</div>';
      infoWindow.setContent(html);
      infoWindow.setPosition(kmlEvent.latLng);
      return infoWindow.open(myMap);
    };
    return google.maps.event.addListener(kmlLayer, 'click', kmlClick);
  };
  google.setOnLoadCallback(init);
}).call(this);

