var REGIONS = [];

REGIONS.push({ id: 71, name: "Açores", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 122, name: "Abruzzo", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 1, name: "Alava", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 2, name: "Albacete", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 146, name: "Algarve", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 3, name: "Alicante", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 4, name: "Almería", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 82, name: "Alsace", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 147, name: "ANDORRA", nation_id: 6, has_hotels: true });

REGIONS.push({ id: 87, name: "Aquitaine", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 5, name: "Asturias", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 91, name: "Auvergne", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 53, name: "Aveiro", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 6, name: "Ávila", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 59, name: "Évora", nation_id: 174, has_hotels: false });

REGIONS.push({ id: 73, name: "Île-de-France", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 7, name: "Badajoz", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 9, name: "Barcelona", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 123, name: "Basilicata", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 78, name: "Basse-Normandie", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 54, name: "Beja", nation_id: 174, has_hotels: false });

REGIONS.push({ id: 79, name: "Bourgogne", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 55, name: "Braga", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 56, name: "Bragança", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 85, name: "Bretagne", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 10, name: "Burgos", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 101, name: "Cabrera", nation_id: 202, has_hotels: false });

REGIONS.push({ id: 124, name: "Calabria", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 125, name: "Campania", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 13, name: "Cantabria", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 14, name: "Castellón", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 57, name: "Castelo Branco", nation_id: 174, has_hotels: false });

REGIONS.push({ id: 11, name: "Cáceres", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 12, name: "Cádiz", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 17, name: "Córdoba", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 77, name: "Centre", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 15, name: "Ceuta", nation_id: 202, has_hotels: false });

REGIONS.push({ id: 74, name: "Champagne-Ardennes", nation_id: 74, has_hotels: false });

REGIONS.push({ id: 104, name: "Chaouia-Ouardigha", nation_id: 143, has_hotels: true });

REGIONS.push({ id: 16, name: "Ciudad Real", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 58, name: "Coimbra", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 94, name: "Corse", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 19, name: "Cuenca", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 142, name: "Cuenca", nation_id: 62, has_hotels: true });

REGIONS.push({ id: 105, name: "Doukhala-Abda", nation_id: 143, has_hotels: false });

REGIONS.push({ id: 95, name: "El Hierro", nation_id: 202, has_hotels: false });

REGIONS.push({ id: 121, name: "Emilia Romagna", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 60, name: "Faro", nation_id: 174, has_hotels: false });

REGIONS.push({ id: 106, name: "Fès-Boulemane", nation_id: 143, has_hotels: true });

REGIONS.push({ id: 103, name: "Formentera", nation_id: 202, has_hotels: false });

REGIONS.push({ id: 83, name: "Franche-Comté", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 126, name: "Friuli Venezia Giulia", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 98, name: "Fuerteventura", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 20, name: "Gerona", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 107, name: "Gharb-Chrarda-Beni Hssen", nation_id: 143, has_hotels: false });

REGIONS.push({ id: 97, name: "Gran Canaria", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 21, name: "Granada", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 108, name: "Grand Casablanca", nation_id: 143, has_hotels: true });

REGIONS.push({ id: 22, name: "Guadalajara", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 61, name: "Guarda", nation_id: 174, has_hotels: false });

REGIONS.push({ id: 143, name: "Guayaquil", nation_id: 62, has_hotels: true });

REGIONS.push({ id: 109, name: "Guelmim-Es Smara", nation_id: 143, has_hotels: false });

REGIONS.push({ id: 23, name: "Guipuzcoa", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 76, name: "Haute-Normadie", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 24, name: "Huelva", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 25, name: "Huesca", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 102, name: "Ibiza", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 26, name: "Jaén", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 113, name: "L\'Oriental", nation_id: 143, has_hotels: false });

REGIONS.push({ id: 18, name: "La Coruña", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 96, name: "La Gomera", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 37, name: "La Palma", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 39, name: "La Rioja", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 110, name: "Laâyoune-Boujdour-Sakia el Hamra", nation_id: 143, has_hotels: false });

REGIONS.push({ id: 92, name: "Languedoc-Rousillon", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 99, name: "Lanzarote", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 127, name: "Lazio", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 28, name: "Lérida", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 27, name: "León", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 62, name: "Leiria", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 128, name: "Liguria", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 89, name: "Limousin", nation_id: 74, has_hotels: false });

REGIONS.push({ id: 63, name: "Lisboa", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 129, name: "Lombardia", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 81, name: "Lorraine", nation_id: 74, has_hotels: false });

REGIONS.push({ id: 29, name: "Lugo", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 72, name: "Madeira", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 30, name: "Madrid", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 8, name: "Mallorca", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 130, name: "Marche", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 111, name: "Marrakech-Tensift-Al Haouz", nation_id: 143, has_hotels: true });

REGIONS.push({ id: 31, name: "Málaga", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 112, name: "Meknès-Tafilalet", nation_id: 143, has_hotels: false });

REGIONS.push({ id: 32, name: "Melilla", nation_id: 202, has_hotels: false });

REGIONS.push({ id: 100, name: "Menorca", nation_id: 202, has_hotels: false });

REGIONS.push({ id: 88, name: "Midi-Pyrenées", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 131, name: "Molise", nation_id: 108, has_hotels: false });

REGIONS.push({ id: 33, name: "Murcia", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 34, name: "Navarra", nation_id: 202, has_hotels: false });

REGIONS.push({ id: 80, name: "Nord-Pas de Calais", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 35, name: "Orense", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 114, name: "Oued Ed-Dahab-Lagouira", nation_id: 143, has_hotels: false });

REGIONS.push({ id: 36, name: "Palencia", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 84, name: "Pays-de-la-Loire", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 75, name: "Picardie", nation_id: 74, has_hotels: false });

REGIONS.push({ id: 132, name: "Piemonte", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 145, name: "Playa de Esmeraldas", nation_id: 62, has_hotels: true });

REGIONS.push({ id: 144, name: "Playa de Salinas", nation_id: 62, has_hotels: true });

REGIONS.push({ id: 86, name: "Poitou-Charentes", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 38, name: "Pontevedra", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 64, name: "Portalegre", nation_id: 174, has_hotels: false });

REGIONS.push({ id: 65, name: "Porto", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 93, name: "Provence-Alpes-Côte-d\'Azur", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 133, name: "Puglia", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 141, name: "Quito", nation_id: 62, has_hotels: true });

REGIONS.push({ id: 115, name: "Rabat-Salé-Zemmour-Zaër", nation_id: 143, has_hotels: false });

REGIONS.push({ id: 90, name: "Rhône-Alpes", nation_id: 74, has_hotels: true });

REGIONS.push({ id: 40, name: "Salamanca", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 41, name: "Santa Cruz de Tenerife", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 66, name: "Santarém", nation_id: 174, has_hotels: false });

REGIONS.push({ id: 134, name: "Sardegna", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 42, name: "Segovia", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 67, name: "Setúbal", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 43, name: "Sevilla", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 135, name: "Sicilia", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 44, name: "Soria", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 116, name: "Sous-Massa-Drâa", nation_id: 143, has_hotels: false });

REGIONS.push({ id: 117, name: "Tadla-Azilal", nation_id: 143, has_hotels: false });

REGIONS.push({ id: 118, name: "Tanger-Tétouan", nation_id: 143, has_hotels: true });

REGIONS.push({ id: 45, name: "Tarragona", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 119, name: "Taza-Al Hoceima-Taounate", nation_id: 143, has_hotels: false });

REGIONS.push({ id: 46, name: "Teruel", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 47, name: "Toledo", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 136, name: "Toscana", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 137, name: "Trentino Alto Adige", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 138, name: "Umbria", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 48, name: "Valencia", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 49, name: "Valladolid", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 139, name: "Valle d´Aosta", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 140, name: "Veneto", nation_id: 108, has_hotels: true });

REGIONS.push({ id: 68, name: "Viana do Castelo", nation_id: 174, has_hotels: false });

REGIONS.push({ id: 69, name: "Vila Real", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 70, name: "Viseu", nation_id: 174, has_hotels: true });

REGIONS.push({ id: 50, name: "Vizcaya", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 51, name: "Zamora", nation_id: 202, has_hotels: true });

REGIONS.push({ id: 52, name: "Zaragoza", nation_id: 202, has_hotels: true });



function nationChanged (nation_selector, region_selector) {
  var nation_id = $F(nation_selector);
  var options = region_selector.options;
  var with_hotels_only = region_selector.hasClassName('with_hotels_only');
  options.length = (options[0] && options[0].value)?0:1;
  REGIONS.each(function (r) {
    if (r.nation_id == nation_id && ((with_hotels_only && r.has_hotels) || !with_hotels_only)) options[options.length] = new Option(r.name, r.id);
  });
}

document.observe("dom:loaded", function () {
  setTimeout(function () {
    var nation_selectors = $$('.nation_selector');
    nation_selectors.each(function (ns) {
      var nation_selector_id = ns.getAttribute('id');
      var region_selector_query = ["#" + nation_selector_id.replace(/(_?)nation_id$/, "$1region_id"), "#" + nation_selector_id.replace(/(_?)nation_id$/, "$1province_id")]
      var region_selector = $$(region_selector_query)[0];
      ns.observe('change', function () {
        nationChanged(ns, region_selector);
      });
    });
  }, 100);
});
