var mapycz = {
description: "Nal\u00E9zt na Mapy.cz",
  shortDescription: "Mapy.cz",
  icon: "http://www.mapy.cz/favicon.ico",
  scope: {
    semantic: {
      "geo" : "geo",
      "hCard" : "adr"
    }
  },

  doAction: function(semanticObject, semanticObjectType, propertyIndex) {
    var url;
    if ((semanticObjectType == "hCard") || (semanticObjectType == "adr")) {
      var adr;
      if (semanticObjectType == "hCard") {
        if (!propertyIndex) {
          propertyIndex = 0;
        }
        adr = semanticObject.adr[propertyIndex];
      } else {
        adr = semanticObject;
      }
      if (adr) {
        url = "http://www.mapy.cz/?fr=";
        if (adr["street-address"]) {
          url += encodeURIComponent(adr["street-address"].join(", "));
        }
        if (adr.locality) {
          url += " " + encodeURIComponent(adr.locality);
        }
        if (adr.region) {
          url += " " + encodeURIComponent(adr.region);
        }
        if (adr["postal-code"]) {
          url += " " + encodeURIComponent(adr["postal-code"]);
        }
        if (adr["country-name"]) {
          url += " " + encodeURIComponent(adr["country-name"]);
        }
      }
    } else if (semanticObjectType == "geo") {
      if (semanticObject.latitude && semanticObject.longitude) {
        url = "http://www.mapy.cz/?fr=Loc:" +
              semanticObject.latitude + "," + semanticObject.longitude;
      }
    }
    return url;
  }
};

SemanticActions.add("mapycz", mapycz);
