<?php
 
$GLOBALS['core_country_list'] = array('AF' => 'Afghanistan', 'AL' => 'Albania', 'DZ' => 'Algeria', 'AD' => 'Andorra', 'AO' => 'Angola', 'AG' => 'Antigua and Barbuda', 'AR' => 'Argentina', 'AM' => 'Armenia', 'AU' => 'Australia', 'AT' => 'Austria', 'AZ' => 'Azerbaijan', 'BS' => 'The Bahamas', 'BH' => 'Bahrain', 'BD' => 'Bangladesh', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgium', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BT' => 'Bhutan', 'BO' => 'Bolivia', 'BA' => 'Bosnia and Herzegovina', 'BW' => 'Botswana', 'BR' => 'Brazil', 'BN' => 'Brunei', 'BG' => 'Bulgaria', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'KH' => 'Cambodia', 'CM' => 'Cameroon', 'CA' => 'Canada', 'CV' => 'Cape Verde', 'CF' => 'Central African Republic', 'TD' => 'Chad', 'CL' => 'Chile', 'CN' => 'China', 'CO' => 'Colombia', 'KM' => 'Comoros', 'CG' => 'Congo, Republic of the', 'CD' => 'Congo, Democratic Republic of the', 'CR' => 'Costa Rica', 'CI' => 'Cote d\'Ivoire', 'HR' => 'Croatia', 'CU' => 'Cuba', 'CY' => 'Cyprus', 'CZ' => 'Czech Republic', 'DK' => 'Denmark', 'DJ' => 'Djibouti', 'DM' => 'Dominica', 'DO' => 'Dominican Republic', 'TL' => 'Timor-Leste', 'EC' => 'Ecuador', 'EG' => 'Egypt', 'SV' => 'El Salvador', 'GQ' => 'Equatorial Guinea', 'ER' => 'Eritrea', 'EE' => 'Estonia', 'ET' => 'Ethiopia', 'FJ' => 'Fiji', 'FI' => 'Finland', 'FR' => 'France', 'GA' => 'Gabon', 'GM' => 'Gambia', 'GE' => 'Georgia', 'DE' => 'Germany', 'GH' => 'Ghana', 'GR' => 'Greece', 'GL' => 'Greenland', 'GD' => 'Grenada', 'GT' => 'Guatemala', 'GN' => 'Guinea', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana', 'HT' => 'Haiti', 'HN' => 'Honduras', 'HU' => 'Hungary', 'IS' => 'Iceland', 'IN' => 'India', 'ID' => 'Indonesia', 'IR' => 'Iran', 'IQ' => 'Iraq', 'IE' => 'Ireland', 'IL' => 'Israel', 'IT' => 'Italy', 'JM' => 'Jamaica', 'JP' => 'Japan', 'JO' => 'Jordan', 'KZ' => 'Kazakhstan', 'KE' => 'Kenya', 'KI' => 'Kiribati', 'KP' => 'Korea, North', 'KR' => 'Korea, South', 'ZZ' => 'Kosovo', 'KW' => 'Kuwait', 'KG' => 'Kyrgyzstan', 'LA' => 'Laos', 'LV' => 'Latvia', 'LB' => 'Lebanon', 'LS' => 'Lesotho', 'LR' => 'Liberia', 'LY' => 'Libya', 'LI' => 'Liechtenstein', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'MK' => 'Macedonia', 'MG' => 'Madagascar', 'MW' => 'Malawi', 'MY' => 'Malaysia', 'MV' => 'Maldives', 'ML' => 'Mali', 'MT' => 'Malta', 'MH' => 'Marshall Islands', 'MR' => 'Mauritania', 'MU' => 'Mauritius', 'MX' => 'Mexico', 'FM' => 'Micronesia, Federated States of', 'MD' => 'Moldova', 'MC' => 'Monaco', 'MN' => 'Mongolia', 'ME' => 'Montenegro', 'MA' => 'Morocco', 'MZ' => 'Mozambique', 'MM' => 'Myanmar (Burma)', 'NA' => 'Namibia', 'NR' => 'Nauru', 'NP' => 'Nepal', 'NL' => 'Netherlands', 'NZ' => 'New Zealand', 'NI' => 'Nicaragua', 'NE' => 'Niger', 'NG' => 'Nigeria', 'NO' => 'Norway', 'OM' => 'Oman', 'PK' => 'Pakistan', 'PW' => 'Palau', 'PA' => 'Panama', 'PG' => 'Papua New Guinea', 'PY' => 'Paraguay', 'PE' => 'Peru', 'PH' => 'Philippines', 'PL' => 'Poland', 'PT' => 'Portugal', 'QA' => 'Qatar', 'RO' => 'Romania', 'RU' => 'Russia', 'RW' => 'Rwanda', 'KN' => 'Saint Kitts and Nevis', 'LC' => 'Saint Lucia', 'VC' => 'Saint Vincent and the Grenadines', 'WS' => 'Samoa', 'SM' => 'San Marino', 'ST' => 'Sao Tome and Principe', 'SA' => 'Saudi Arabia', 'SN' => 'Senegal', 'RS' => 'Serbia', 'SC' => 'Seychelles', 'SL' => 'Sierra Leone', 'SG' => 'Singapore', 'SK' => 'Slovakia', 'SI' => 'Slovenia', 'SB' => 'Solomon Islands', 'SO' => 'Somalia', 'ZA' => 'South Africa', 'SS' => 'South Sudan', 'ES' => 'Spain', 'LK' => 'Sri Lanka', 'SD' => 'Sudan', 'SR' => 'Suriname', 'SZ' => 'Swaziland', 'SE' => 'Sweden', 'CH' => 'Switzerland', 'SY' => 'Syria', 'TW' => 'Taiwan', 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania', 'TH' => 'Thailand', 'TG' => 'Togo', 'TO' => 'Tonga', 'TT' => 'Trinidad and Tobago', 'TN' => 'Tunisia', 'TR' => 'Turkey', 'TM' => 'Turkmenistan', 'TV' => 'Tuvalu', 'UG' => 'Uganda', 'UA' => 'Ukraine', 'AE' => 'United Arab Emirates', 'GB' => 'United Kingdom', 'US' => 'USA', 'UY' => 'Uruguay', 'UZ' => 'Uzbekistan', 'VU' => 'Vanuatu', 'VA' => 'Vatican City (Holy See)', 'VE' => 'Venezuela', 'VN' => 'Vietnam', 'YE' => 'Yemen', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe', 'HK' => 'Hong Kong', 'PR' => 'Puerto Rico');




$GLOBALS['core_state_list'] = array(

"AF" => "Badakhshan|Badghis|Baghlan|Balkh|Bamian|Farah|Faryab|Ghazni|Ghowr|Helmand|Herat|Jowzjan|Kabol|Kandahar|Kapisa|Konar|Kondoz|Laghman|Lowgar|Nangarhar|Nimruz|Oruzgan|Paktia|Paktika|Parvan|Samangan|Sar-e Pol|Takhar|Vardak|Zabol",
"AL" => "Berat|Bulqize|Delvine|Devoll [Bilisht]|Diber [Peshkopi]|Durres|Elbasan|Fier|Gjirokaster|Gramsh|Has [Krume]|Kavaje|Kolonje [Erseke]|Korce|Kruje|Kucove|Kukes|Kurbin|Lezhe|Librazhd|Lushnje|Malesi e Madhe [Koplik|Mallakaster [Ballsh]|Mat [Burrel]|Mirdite [Rreshen]|Peqin|Permet|Pogradec|Puke|Sarande|Shkoder|Skrapar [Corovode]|Tepelene|Tirane [Tirana]|Tirane [Tirana]|Tropoje [Bajram Curri]|Vlore",
 'DZ' => 'Adrar|Ain Defla|Ain Temouchent|Alger|Annaba|Batna|Bechar|Bejaia|Biskra|Blida|Bordj Bou Arreridj|Bouira|Boumerdes|Chlef|Constantine|Djelfa|El Bayadh|El Oued|El Tarf|Ghardaia|Guelma|Illizi|Jijel|Khenchela|Laghouat|M\'Sila|Mascara|Medea|Mila|Mostaganem|Naama|Oran|Ouargla|Oum el Bouaghi|Relizane|Saida|Setif|Sidi Bel Abbes|Skikda|Souk Ahras|Tamanghasset|Tebessa|Tiaret|Tindouf|Tipaza|Tissemsilt|Tizi Ouzou|Tlemcen', 
 'AD' => 'Andorra', 
 'AO' => 'Andorra la Vella|Bengo|Benguela|Bie|Cabinda|Canillo|Cuando Cubango|Cuanza Norte|Cuanza Sul|Cunene|Encamp|Escaldes-Engordany|Huambo|Huila|La Massana|Luanda|Lunda Norte|Lunda Sul|Malanje|Moxico|Namibe|Ordino|Sant Julia de Loria|Uige|Zaire', 
 'AG' => 'Barbuda|Redonda|Saint George|Saint John|Saint Mary|Saint Paul|Saint Peter|Saint Philip', 
 'AR' => 'Antartica e Islas del Atlantico Sur|Buenos Aires|Buenos Aires Capital Federal|Catamarca|Chaco|Chubut|Cordoba|Corrientes|Entre Rios|Formosa|Jujuy|La Pampa|La Rioja|Mendoza|Misiones|Neuquen|Rio Negro|Salta|San Juan|San Luis|Santa Cruz|Santa Fe|Santiago del Estero|Tierra del Fuego|Tucuman', 
 'AM' => 'Aragatsotn|Ararat|Armavir|Geghark unik|Kotayk|Lorri|Shirak|Syunik|Tavush|Vayots|Dzor|Yerevan', 
 'AU' => 'Australian Capital Territory|New South Wales|Northern Territory|Queensland|South Australia|Tasmania|Victoria|Western Australia', 
 'AT' => 'Burgenland|Kaernten|Niederoesterreich|Oberoesterreich|Salzburg|Steiermark|Tirol|Vorarlberg|Wien',  
 'AZ' => 'Abseron Rayonu|Agcabadi Rayonu|Agdam Rayonu|Agdas Rayonu|Agstafa Rayonu|Agsu Rayonu|Ali Bayramli Sahari|Astara Rayonu|Baki Sahari|Balakan Rayonu|Barda Rayonu|Beylaqan Rayonu|Bilasuvar Rayonu|Cabrayil Rayonu|Calilabad Rayonu|Daskasan Rayonu|Davaci Rayonu|Fuzuli Rayonu|Gadabay Rayonu|Ganca Sahari|Goranboy Rayonu|Goycay Rayonu|Haciqabul Rayonu|Imisli Rayonu|Ismayilli Rayonu|Kalbacar Rayonu|Kurdamir Rayonu|Lacin Rayonu|Lankaran Rayonu|Lankaran Sahari|Lerik Rayonu|Masalli Rayonu|Mingacevir Sahari|Naftalan Sahari|Naxcivan Muxtar Respublikasi|Neftcala Rayonu|Oguz Rayonu|Qabala Rayonu|Qax Rayonu|Qazax Rayonu|Qobustan Rayonu|Quba Rayonu|Qubadli Rayonu|Qusar Rayonu|Saatli Rayonu|Sabirabad Rayonu|Saki Rayonu|Saki Sahari|Salyan Rayonu|Samaxi Rayonu|Samkir Rayonu|Samux Rayonu|Siyazan Rayonu|Sumqayit Sahari|Susa Rayonu|Susa Sahari|Tartar Rayonu|Tovuz Rayonu|Ucar Rayonu|Xacmaz Rayonu|Xankandi Sahari|Xanlar Rayonu|Xizi Rayonu|Xocali Rayonu|Xocavand Rayonu|Yardimli Rayonu|Yevlax Rayonu|Yevlax Sahari|Zangilan Rayonu|Zaqatala Rayonu|Zardab Rayonu', 
 'BS' => 'Acklins and Crooked Islands|Bimini|Cat Island|Exuma|Freeport|Fresh Creek|Governors Harbour|Green Turtle Cay|Harbour Island|High Rock|Inagua|Kemps Bay|Long Island|Marsh Harbour|Mayaguana|New Providence|Nicholls Town and Berry Islands|Ragged Island|Rock Sound|San Salvador and Rum Cay|Sandy Point', 
 'BH' => 'Al Hadd|Al Manamah|Al Mintaqah al Gharbiyah|Al Mintaqah al Wusta|Al Mintaqah ash Shamaliyah|Al Muharraq|Ar Rifa wa al Mintaqah al Janubiyah|Jidd Hafs|Juzur Hawar|Madinat Isa|Madinat Hamad|Sitrah', 
 'BD' => 'Barguna|Barisal|Bhola|Jhalokati|Patuakhali|Pirojpur|Bandarban|Brahmanbaria|Chandpur|Chittagong|Comilla|Coxs Bazar|Feni|Khagrachari|Lakshmipur|Noakhali|Rangamati|Dhaka|Faridpur|Gazipur|Gopalganj|Jamalpur|Kishoreganj|Madaripur|Manikganj|Munshiganj|Mymensingh|Narayanganj|Narsingdi|Netrokona|Rajbari|Shariatpur|Sherpur|Tangail|Bagerhat|Chuadanga|Jessore|Jhenaidah|Khulna|Kushtia|Magura|Meherpur|Narail|Satkhira|Bogra|Dinajpur|Gaibandha|Jaipurhat|Kurigram|Lalmonirhat|Naogaon|Natore|Nawabganj|Nilphamari|Pabna|Panchagarh|Rajshahi|Rangpur|Sirajganj|Thakurgaon|Habiganj|Maulvi bazar|Sunamganj|Sylhet', 
 'BB' => 'Bridgetown|Christ Church|Saint Andrew|Saint George|Saint James|Saint John|Saint Joseph|Saint Lucy|Saint Michael|Saint Peter|Saint Philip|Saint Thomas', 
 'BY' => 'Brestskaya [Brest]|Homyel skaya [Homyel]|Horad Minsk|Hrodzyenskaya [Hrodna]|Mahilyowskaya [Mahilyow]|Minskaya|Vitsyebskaya [Vitsyebsk]', 
 'BE' => 'Antwerpen|Brabant Wallon|Brussels Capitol Region|Hainaut|Liege|Limburg|Luxembourg|Namur|Oost-Vlaanderen|Vlaams Brabant|West-Vlaanderen', 
 
 
  'BZ' => 'Belize|Cayo|Corozal|Orange Walk|Stann Creek|Toledo', 
'BJ' => 'Alibori|Atakora|Atlantique|Borgou|Collines|Couffo|Donga|Littoral|Mono|Oueme|Plateau|Zou', 
 'BM' => 'Devonshire|Hamilton|Hamilton|Paget|Pembroke|Saint George|Saint Georges|Sandys|Smiths|Southampton|Warwick', 
'BT' => 'Bumthang|Chhukha|Chirang|Daga|Geylegphug|Ha|Lhuntshi|Mongar|Paro|Pemagatsel|Punakha|Samchi|Samdrup Jongkhar|Shemgang|Tashigang|Thimphu|Tongsa|Wangdi Phodrang', 
'BO' => 'Beni|Chuquisaca|Cochabamba|La Paz|Oruro|Pando|Potosi|Santa Cruz|Tarija', 
 
'BQ' => 'Bonaire',

'BA' => 'Federation of Bosnia and Herzegovina|Republika Srpska', 
'BW' => 'Central|Chobe|Francistown|Gaborone|Ghanzi|Kgalagadi|Kgatleng|Kweneng|Lobatse|Ngamiland|North-East|Selebi-Pikwe|South-East|Southern', 
'BV' => 'Bouvet Island', 
'BR' => 'Acre|Alagoas|Amapa|Amazonas|Bahia|Ceara|Distrito Federal|Espirito Santo|Goias|Maranhao|Mato Grosso|Mato Grosso do Sul|Minas Gerais|Para|Paraiba|Parana|Pernambuco|Piaui|Rio de Janeiro|Rio Grande do Norte|Rio Grande do Sul|Rondonia|Roraima|Santa Catarina|Sao Paulo|Sergipe|Tocantins', 

 'IO' => 'British Indian Ocean Territory', 
 'BN' => 'Belait|Brunei and Muara|Temburong|Tutong', 
 'BG' => 'Blagoevgrad|Burgas|Dobrich|Gabrovo|Khaskovo|Kurdzhali|Kyustendil|Lovech|Montana|Pazardzhik|Pernik|Pleven|Plovdiv|Razgrad|Ruse|Shumen|Silistra|Sliven|Smolyan|Sofiya|Sofiya-Grad|Stara Zagora|Turgovishte|Varna|Veliko Turnovo|Vidin|Vratsa|Yambol', 

'BF' => 'Bale|Bam|Banwa|Bazega|Bougouriba|Boulgou|Boulkiemde|Comoe|Ganzourgou|Gnagna|Gourma|Houet|Ioba|Kadiogo|Kenedougou|Komandjari|Kompienga|Kossi|Koupelogo|Kouritenga|Kourweogo|Leraba|Loroum|Mouhoun|Nahouri|Namentenga|Naumbiel|Nayala|Oubritenga|Oudalan|Passore|Poni|Samentenga|Sanguie|Seno|Sissili|Soum|Sourou|Tapoa|Tuy|Yagha|Yatenga|Ziro|Zondomo|Zoundweogo',

'BI' => 'Bubanza|Bujumbura|Bururi|Cankuzo|Cibitoke|Gitega|Karuzi|Kayanza|Kirundo|Makamba|Muramvya|Muyinga|Mwaro|Ngozi|Rutana|Ruyigi',
 'KH' => 'Banteay Mean Cheay|Batdambang|Kampong Cham|Kampong Chhnang|Kampong Spoe|Kampong Thum|Kampot|Kandal|Kaoh Kong|Keb|Kracheh|Mondol Kiri|Otdar Mean Cheay|Pailin|Phnum Penh|Pouthisat|Preah Seihanu [Sihanoukville]|Preah Vihear|Prey Veng|Rotanah Kiri|Siem Reab|Stoeng Treng|Svay Rieng|Takev', 
 'CM' => 'Adamaoua|Centre|Est|Extreme-Nord|Littoral|Nord|Nord-Ouest|Ouest|Sud|Sud-Ouest', 
 'CA' => 'Alberta|British Columbia|Manitoba|New Brunswick|Newfoundland|Northwest Territories|Nova Scotia|Nunavut|Ontario|Prince Edward Island|Quebec|Saskatchewan|Yukon', 
'CV' => 'Boa Vista|Brava|Maio|Mosteiros|Paul|Porto Novo|Praia|Ribeira Grande|Sal|Santa Catarina|Santa Cruz|Sao Domingos|Sao Filipe|Sao Nicolau|Sao Vicente|Tarrafal',
'KY' => 'Creek|Eastern|Midland|South Town|Spot Bay|Stake Bay|West End|Western', 
'CF' => 'Bamingui-Bangoran|Bangui|Basse-Kotto|Gribingui|Haut-Mbomou|Haute-Kotto|Haute-Sangha|Kemo-Gribingui|Lobaye|Mbomou|Nana-Mambere|Ombella-Mpoko|Ouaka|Ouham|Ouham-Pende|Sangha|Vakaga',


 
'TD'=> 'Batha|Biltine|Borkou-Ennedi-Tibesti|Chari-Baguirmi|Guera|Kanem|Lac|Logone Occidental|Logone Oriental|Mayo-Kebbi|Moyen-Chari|Ouaddai|Salamat|Tandjile',
'CL'=> "Aisen del General Carlos Ibanez del Campo|Antofagasta|Araucania|Atacama|Bio-Bio|Coquimbo|Libertador General Bernardo O'Higgins|Los Lagos|Magallanes y de la Antartica Chilena|Maule|Region Metropolitana [Santiago]|Tarapaca|Valparaiso", 
'CN'=> 'Anhui|Beijing|Chongqing|Fujian|Gansu|Guangdong|Guangxi|Guizhou|Hainan|Hebei|Heilongjiang|Henan|Hubei|Hunan|Jiangsu|Jiangxi|Jilin|Liaoning|Nei Mongol|Ningxia|Qinghai|Shaanxi|Shandong|Shanghai|Shanxi|Sichuan|Tianjin|Xinjiang|Xizang [Tibet]|Yunnan|Zhejiang', 
 'CX'=> 'Christmas Island', 
'CC'=> 'Direction Island|Home Island|Horsburgh Island|North Keeling Island|South Island|West Island', 
'CO'=> 'Amazonas|Antioquia|Arauca|Atlantico|Bolivar|Boyaca|Caldas|Caqueta|Casanare|Cauca|Cesar|Choco|Cordoba|Cundinamarca|Distrito Capital de Santa Fe de Bogota|Guainia|Guaviare|Huila|La Guajira|Magdalena|Meta|Narino|Norte de Santander|Putumayo|Quindio|Risaralda|San Andres y Providencia|Santander|Sucre|Tolima|Valle del Cauca|Vaupes|Vichada',
'KM'=> 'Anjouan [Nzwani]|Domoni|Fomboni|Grande Comore [Njazidja]|Moheli [Mwali]|Moroni|Moutsamoudou',
'CG'=> 'Bouenza|Brazzaville|Cuvette|Kouilou|Lekoumou|Likouala|Niari|Plateaux|Pool|Sangha',
'CD'=> 'Bandundu|Bas-Congo|Equateur|Kasai-Occidental|Kasai-Oriental|Katanga|Kinshasa|Maniema|Nord-Kivu|Orientale|Sud-Kivu',
'CK'=> 'Aitutaki|Atiu|Avarua|Mangaia|Manihiki|Manuae|Mauke|Mitiaro|Nassau Island|Palmerston|Penrhyn|Pukapuka|Rakahanga|Rarotonga|Suwarrow|Takutea',
'CR'=> 'Alajuela|Cartago|Guanacaste|Heredia|Limon|Puntarenas|San Jose', 
'CI' => "Abengourou|Abidjan|Aboisso|Adiake'|Adzope|Agboville|Agnibilekrou|Ale'pe'|Bangolo|Beoumi|Biankouma|Bocanda|Bondoukou|Bongouanou|Bouafle|Bouake|Bouna|Boundiali|Dabakala|Dabon|Daloa|Danane|Daoukro|Dimbokro|Divo|Duekoue|Ferkessedougou|Gagnoa|Grand Bassam|Grand-Lahou|Guiglo|Issia|Jacqueville|Katiola|Korhogo|Lakota|Man|Mankono|Mbahiakro|Odienne|Oume|Sakassou|San-Pedro|Sassandra|Seguela|Sinfra|Soubre|Tabou|Tanda|Tiassale|Tiebissou|Tingrela|Touba|Toulepleu|Toumodi|Vavoua|Yamoussoukro|Zuenoula", 
'HR'=> 'Bjelovarsko-Bilogorska Zupanija|Brodsko-Posavska Zupanija|Dubrovacko-Neretvanska Zupanija|Istarska Zupanija|Karlovacka Zupanija|Koprivnicko-Krizevacka Zupanija|Krapinsko-Zagorska Zupanija|Licko-Senjska Zupanija|Medimurska Zupanija|Osjecko-Baranjska Zupanija|Pozesko-Slavonska Zupanija|Primorsko-Goranska Zupanija|Sibensko-Kninska Zupanija|Sisacko-Moslavacka Zupanija|Splitsko-Dalmatinska Zupanija|Varazdinska Zupanija|Viroviticko-Podravska Zupanija|Vukovarsko-Srijemska Zupanija|Zadarska Zupanija|Zagreb|Zagrebacka Zupanija', 
'CU'=> 'Camaguey|Ciego de Avila|Cienfuegos|Ciudad de La Habana|Granma|Guantanamo|Holguin|Isla de la Juventud|La Habana|Las Tunas|Matanzas|Pinar del Rio|Sancti Spiritus|Santiago de Cuba|Villa Clara',
'CW'=> 'Curacao',
'CY'=> 'Famagusta|Kyrenia|Larnaca|Limassol|Nicosia|Paphos', 
'CZ'=> 'Brnensky|Budejovicky|Jihlavsky|Karlovarsky|Kralovehradecky|Liberecky|Olomoucky|Ostravsky|Pardubicky|Plzensky|Praha|Stredocesky|Ustecky|Zlinsky', 
'DK'=> 'Arhus|Bornholm|Fredericksberg|Frederiksborg|Greenland|Fyn|Kobenhavn|Kobenhavns|Nordjylland|Ribe|Ringkobing|Roskilde|Sonderjylland|Storstrom|Vejle|Vestsjalland|Viborg',
'DJ'=> "'Ali Sabih|Dikhil|Djibouti|Obock|Tadjoura", 
'DM'=> 'Saint Andrew|Saint David|Saint George|Saint John|Saint Joseph|Saint Luke|Saint Mark|Saint Patrick|Saint Paul|Saint Peter', 
'DO'=> 'Azua|Baoruco|Barahona|Dajabon|Distrito Nacional|Duarte|El Seibo|Elias Pina|Espaillat|Hato Mayor|Independencia|La Altagracia|La Romana|La Vega|Maria Trinidad Sanchez|Monsenor Nouel|Monte Cristi|Monte Plata|Pedernales|Peravia|Puerto Plata|Salcedo|Samana|San Cristobal|San Juan|San Pedro de Macoris|Sanchez Ramirez|Santiago|Santiago Rodriguez|Valverde', 
'EC'=> 'Azuay|Bolivar|Canar|Carchi|Chimborazo|Cotopaxi|El Oro|Esmeraldas|Galapagos|Guayas|Imbabura|Loja|Los Rios|Manabi|Morona-Santiago|Napo|Orellana|Pastaza|Pichincha|Sucumbios|Tungurahua|Zamora-Chinchipe',
'EG'=> "Ad Daqahliyah|Al Bahr al Ahmar|Al Buhayrah|Al Fayyum|Al Gharbiyah|Al Iskandariyah|Al Isma'iliyah|Al Jizah|Al Minufiyah|Al Minya|Al Qahirah|Al Qalyubiyah|Al Wadi al Jadid|As Suways|Ash Sharqiyah|Aswan|Asyut|Bani Suwayf|Bur Sa'id|Dumyat|Janub Sina'|Kafr ash Shaykh|Matruh|Qina|Shamal Sina'|Suhaj",
'SV'=> 'Ahuachapan|Cabanas|Chalatenango|Cuscatlan|La Libertad|La Paz|La Union|Morazan|San Miguel|San Salvador|San Vicente|Santa Ana|Sonsonate|Usulutan',
'GQ'=> 'Annobon|Bioko Norte|Bioko Sur|Centro Sur|Kie-Ntem|Litoral|Wele-Nzas',
'ER'=> 'Akale Guzay|Barka|Denkel|Hamasen|Sahil|Semhar|Senhit|Seraye',
'EE'=> 'Harjumaa [Tallinn]|Hiiumaa [Kardla]|Ida-Virumaa [Johvi]|Jarvamaa [Paide]|Jogevamaa [Jogeva]|Laane-Virumaa [Rakvere]|Laanemaa [Haapsalu]|Parnumaa [Parnu]|Polvamaa [Polva]|Raplamaa [Rapla]|Saaremaa [Kuessaare]|Tartumaa [Tartu]|Valgamaa [Valga]|Viljandimaa [Viljandi]|Vorumaa [Voru]',
 'ET'=> 'Adis Abeba [Addis Ababa]|Afar|Amara|Dire Dawa|Gambela Hizboch|Hareri Hizb|Oromiya|Sumale|Tigray|YeDebub Biheroch Bihereseboch na Hizboch', 
'FK'=> 'Falkland Islands [Islas Malvinas]', 
'FO'=>  'Bordoy|Eysturoy|Mykines|Sandoy|Skuvoy|Streymoy|Suduroy|Tvoroyri|Vagar',
'FJ'=> 'Central|Eastern|Northern|Rotuma|Western',
'FI'=> 'Aland|Etela-Suomen Laani|Ita-Suomen Laani|Lansi-Suomen Laani|Lappi|Oulun Laani', 
'FR'=> "Alsace|Aquitaine|Auvergne|Basse-Normandie|Bourgogne|Bretagne|Centre|Champagne-Ardenne|Corse|Franche-Comte|Haute-Normandie|Ile-de-France|Languedoc-Roussillon|Limousin|Lorraine|Midi-Pyrenees|Nord-Pas-de-Calais|Pays de la Loire|Picardie|Poitou-Charentes|Provence-Alpes-Cote d'Azur|Rhone-Alpes",
'GF'=> 'French Guiana',
'PF'=> 'Archipel des Marquises|Archipel des Tuamotu|Archipel des Tubuai|Iles du Vent|Iles Sous-le-Vent', 
 'TF'=> 'Adelie Land|Ile Crozet|Iles Kerguelen|Iles Saint-Paul et Amsterdam',
'GA'=> 'Estuaire|Haut-Ogooue|Moyen-Ogooue|Ngounie|Nyanga|Ogooue-Ivindo|Ogooue-Lolo|Ogooue-Maritime|Woleu-Ntem',
 'GM'=> 'Banjul|Central River|Lower River|North Bank|Upper River|Western',
'GE'=> "Abashis|Abkhazia or Ap'khazet'is Avtonomiuri Respublika [Sokhumi]|Adigenis|Ajaria or Acharis Avtonomiuri Respublika [Bat'umi]|Akhalgoris|Akhalk'alak'is|Akhalts'ikhis|Akhmetis|Ambrolauris|Aspindzis|Baghdat'is|Bolnisis|Borjomis|Ch'khorotsqus|Ch'okhatauris|Chiat'ura|Dedop'listsqaros|Dmanisis|Dushet'is|Gardabanis|Gori|Goris|Gurjaanis|Javis|K'arelis|K'ut'aisi|Kaspis|Kharagaulis|Khashuris|Khobis|Khonis|Lagodekhis|Lanch'khut'is|Lentekhis|Marneulis|Martvilis|Mestiis|Mts'khet'is|Ninotsmindis|Onis|Ozurget'is|P'ot'i|Qazbegis|Qvarlis|Rust'avi|Sach'kheris|Sagarejos|Samtrediis|Senakis|Sighnaghis|T'bilisi|T'elavis|T'erjolis|T'et'ritsqaros|T'ianet'is|Tqibuli|Ts'ageris|Tsalenjikhis|Tsalkis|Tsqaltubo|Vanis|Zestap'onis|Zugdidi|Zugdidis", 
'DE'=> 'Brandenburg|Berlin|Baden-W\xfcrttemberg|Bayern [Bavaria]|Bremen|Hessen|Hamburg|Mecklenburg-Vorpommern|Niedersachsen [Lower Saxony]|Nordrhein-Westfalen|Rheinland-Pfalz [Palatinate]|Schleswig-Holstein|Saarland|Sachsen [Saxony]|Sachsen-Anhalt [Saxony-Anhalt]|Th\xfcringen [Thuringia]',
 'GH'=> 'Ashanti|Brong-Ahafo|Central|Eastern|Greater Accra|Northern|Upper East|Upper West|Volta|Western',
'GI'=> 'Gibraltar', 
'GR'=> 'Achaea|Aetolia-Acarnania|Arcadia|Argolis|Arta|Athens|Boeotia|Chalcidice|Chania|Chios|Corfu|Corinthia|Cyclades|Dodecanese|Drama|East Attica|Elis|Euboea|Evros|Evrytania|Florina|Grevena|Heraklion|Imathia|Ioannina|Karditsa|Kastoria|Kavala|Kefalonia and Ithaka|Kilkis|Kozani|Laconia|Larissa|Lasithi|Lefkada|Lesbos|Magnesia|Messenia|Pella|Phocis|Phthiotis|Pieria|Piraeus|Preveza|Rethymno|Rhodope|Samos|Serres|Thesprotia|Thessaloniki|Trikala|West Attica|Xanthi|Zakynthos',
'GL'=> 'Avannaa [Nordgronland]|Kitaa [Vestgronland]|Tunu [Ostgronland]', 
'GD'=> 'Carriacou and Petit Martinique|Saint Andrew|Saint David|Saint George|Saint John|Saint Mark|Saint Patrick',
'GP'=> 'Basse-Terre|Grande-Terre|Iles de la Petite Terre|Iles des Saintes|Marie-Galante', 
'GU'=> 'Guam',
'GT'=> 'Alta Verapaz|Baja Verapaz|Chimaltenango|Chiquimula|El Progreso|Escuintla|Guatemala|Huehuetenango|Izabal|Jalapa|Jutiapa|Peten|Quetzaltenango|Quiche|Retalhuleu|Sacatepequez|San Marcos|Santa Rosa|Solola|Suchitepequez|Totonicapan|Zacapa',
 
'GG' => 'Castel|Forest|St. Andrew|St. Martin|St. Peter Port|St. Pierre du Bois|St. Sampson|St. Saviour|Torteval|Vale', 
'GN'	=> 'Beyla|Boffa|Boke|Conakry|Coyah|Dabola|Dalaba|Dinguiraye|Dubreka|Faranah|Forecariah|Fria|Gaoual|Gueckedou|Kankan|Kerouane|Kindia|Kissidougou|Koubia|Koundara|Kouroussa|Labe|Lelouma|Lola|Macenta|Mali|Mamou|Mandiana|Nzerekore|Pita|Siguiri|Telimele|Tougue|Yomou', 
'GW'	=> 'Bafata|Biombo|Bissau|Bolama-Bijagos|Cacheu|Gabu|Oio|Quinara|Tombali',  
'GY'	=> 'Barima-Waini|Cuyuni-Mazaruni|Demerara-Mahaica|East Berbice-Corentyne|Essequibo Islands-West Demerara|Mahaica-Berbice|Pomeroon-Supenaam|Potaro-Siparuni|Upper Demerara-Berbice|Upper Takutu-Upper Essequibo', 
'HT'	=> "Artibonite|Centre|Grand'Anse|Nord|Nord-Est|Nord-Ouest|Ouest|Sud|Sud-Est",  
'HM'	=> 'Heard Island and McDonald Islands',  
'VA' 	=> 'Holy See [Vatican City]', 
'HN'	=> 'Atlantida|Choluteca|Colon|Comayagua|Copan|Cortes|El Paraiso|Francisco Morazan|Gracias a Dios|Intibuca|Islas de la Bahia|La Paz|Lempira|Ocotepeque|Olancho|Santa Barbara|Valle|Yoro',  
'HK'	=> 'Hong Kong', 
'HU'	=> 'Bacs-Kiskun|Baranya|Bekes|Bekescsaba|Borsod-Abauj-Zemplen|Budapest|Csongrad|Debrecen|Dunaujvaros|Eger|Fejer|Gyor|Gyor-Moson-Sopron|Hajdu-Bihar|Heves|Hodmezovasarhely|Jasz-Nagykun-Szolnok|Kaposvar|Kecskemet|Komarom-Esztergom|Miskolc|Nagykanizsa|Nograd|Nyiregyhaza|Pecs|Pest|Somogy|Sopron|Szabolcs-Szatmar-Bereg|Szeged|Szekesfehervar|Szolnok|Szombathely|Tatabanya|Tolna|Vas|Veszprem|Veszprem|Zala|Zalaegerszeg', 
'IS'=> 'Akranes|Akureyri|Arnessysla|Austur-Bardhastrandarsysla|Austur-Hunavatnssysla|Austur-Skaftafellssysla|Borgarfjardharsysla|Dalasysla|Eyjafjardharsysla|Gullbringusysla|Hafnarfjordhur|Husavik|Isafjordhur|Keflavik|Kjosarsysla|Kopavogur|Myrasysla|Neskaupstadhur|Nordhur-Isafjardharsysla|Nordhur-Mulasys-la|Nordhur-Thingeyjarsysla|Olafsfjordhur|Rangarvallasysla|Reykjavik|Saudharkrokur|Seydhisfjordhur|Siglufjordhur|Skagafjardharsysla|Snaefellsnes-og Hnappadalssysla|Strandasysla|Sudhur-Mulasysla|Sudhur-Thingeyjarsysla|Vesttmannaeyjar|Vestur-Bardhastrandarsysla|Vestur-Hunavatnssysla|Vestur-Isafjardharsysla|Vestur-Skaftafellssysla',  
'IN'=> 'Andaman and Nicobar Islands|Andhra Pradesh|Arunachal Pradesh|Assam|Bihar|Chandigarh|Chhattisgarh|Dadra and Nagar Haveli|Daman and Diu|Delhi|Goa|Gujarat|Haryana|Himachal Pradesh|Jammu and Kashmir|Jharkhand|Karnataka|Kerala|Lakshadweep|Madhya Pradesh|Maharashtra|Manipur|Meghalaya|Mizoram|Nagaland|Orissa|Pondicherry|Punjab|Rajasthan|Sikkim|Tamil Nadu|Telangana State|Tripura|Uttar Pradesh|Uttaranchal|West Bengal',  
'ID'=> 'Aceh|Bali|Banten|Bengkulu|East Timor|Gorontalo|Irian Jaya|Jakarta Raya|Jambi|Jawa Barat|Jawa Tengah|Jawa Timur|Kalimantan Barat|Kalimantan Selatan|Kalimantan Tengah|Kalimantan Timur|Kepulauan Bangka Belitung|Lampung|Maluku|Maluku Utara|Nusa Tenggara Barat|Nusa Tenggara Timur|Riau|Sulawesi Selatan|Sulawesi Tengah|Sulawesi Tenggara|Sulawesi Utara|Sumatera Barat|Sumatera Selatan|Sumatera Utara|Yogyakarta',  

'IR'=> 'Ardabil|Azarbayjan-e Gharbi|Azarbayjan-e Sharqi|Bushehr|Chahar Mahall va Bakhtiari|Esfahan|Fars|Gilan|Golestan|Hamadan|Hormozgan|Ilam|Kerman|Kermanshah|Khorasan|Khuzestan|Kohgiluyeh va Buyer Ahmad|Kordestan|Lorestan|Markazi|Mazandaran|Qazvin|Qom|Semnan|Sistan va Baluchestan|Tehran|Yazd|Zanjan',  
'IQ'=> "Al Anbar|Al Basrah|Al Muthanna|Al Qadisiyah|An Najaf|Arbil|As Sulaymaniyah|At Ta'mim|Babil|Baghdad|Dahuk|Dhi Qar|Diyala|Karbala'|Maysan|Ninawa|Salah ad Din|Wasit",  
'IE'=> 'Co. Carlow|Co. Cavan|Co. Clare|Co. Cork|Co. Donegal|Co. Dublin|Co. Galway|Co. Kerry|Co. Kildare|Co. Kilkenny|Co. Laois|Co. Leitrim|Co. Limerick|Co. Longford|Co. Louth|Co. Mayo|Co. Meath|Co. Monaghan|Co. Offaly|Co. Roscommon|Co. Sligo|Co. Tipperary|Co. Waterford|Co. Westmeath|Co. Wexford|Co. Wicklow',  
'IM'=> 'Isle of Man', 
'IL'=> 'Central|Haifa|Jerusalem|Northern|Southern|Tel Aviv',  
'IT'=> "Agrigento|Alessandria|Ancona|Aosta|Ascoli Piceno|L'Aquila|Arezzo|Asti|Avellino|Bari|Bergamo|Biella|Belluno|Benevento|Bologna|Brindisi|Brescia|Barletta-Andria-Trani|Bolzano-Bozen|Cagliari|Campobasso|Caserta|Chieti|Carbonia-Inglesias|Caltanissetta|Cuneo|Como|Cremona|Cosenza|Catania|Catanzaro|Enna|Forl\xec-Cesena|Ferrara|Foggia|Firenze|Fermo|Frosinone|Genova|Gorizia|Grosseto|Imperia|Isernia|Crotone|Lecco|Lecce|Livorno|Lodi|Latina|Lucca|Monza e Brianza|Macerata|Messina|Milano|Mantova|Modena|Massa-Carrara|Matera|Napoli|Novara|Nuoro|Ogliastra|Oristano|Olbia-Tempio|Palermo|Piacenza|Padova|Pescara|Perugia|Pisa|Pordenone|Prato|Parma|Pistoia|Pesaro e Urbino|Pavia|Potenza|Ravenna|Reggio Calabria|Reggio Elilia|Ragusa|Rieti|Roma|Rimini|Rovigo|Salerno|Siena|Sondrio|La Spezia|Siracusa|Sassari|Savona|Taranto|Teramo|Trento|Torino|Trapani|Terni|Trieste|Treviso|Udine|Varese|Verbano-Cusio-Ossola|Vercelli|Venezia|Vicenza|Verona|Medio Campidano|Viterbo|Vibo Valentia",  
'JM'=> 'Clarendon|Hanover|Kingston|Manchester|Portland|Saint Andrew|Saint Ann|Saint Catherine|Saint Elizabeth|Saint James|Saint Mary|Saint Thomas|Trelawny|Westmoreland', 
'JP'=> 'Aichi|Akita|Aomori|Chiba|Ehime|Fukui|Fukuoka|Fukushima|Gifu|Gunma|Hiroshima|Hokkaido|Hyogo|Ibaragi|Ishikawa|Iwate|Kagawa|Kagoshima|Kanagawa|Kochi|Kumamoto|Kyoto|Mie|Miyagi|Miyazaki|Nagano|Nagasaki|Nara|Niigata|Oita|Okayama|Okinawa|Osaka|Saga|Saitama|Shiga|Shimane|Shizuoka|Tochigi|Tokushima|Tokyo|Tottori|Toyama|Wakayama|Yamagata|Yamaguchi|Yamanashi',  
'JE'=> 'Jersey', 
'JO'=> "'Amman|Ajlun|Al 'Aqabah|Al Balqa'|Al Karak|Al Mafraq|At Tafilah|Az Zarqa'|Irbid|Jarash|Ma'an|Madaba",  
'KZ'=> 'Almaty|Aqmola|Aqtobe|Astana|Atyrau|Batys Qazaqstan|Bayqongyr|Mangghystau|Ongtustik Qazaqstan|Pavlodar|Qaraghandy|Qostanay|Qyzylorda|Shyghys Qazaqstan|Soltustik Qazaqstan|Zhambyl', 
'KE'=> 'Central|Coast|Eastern|Nairobi Area|North Eastern|Nyanza|Rift Valley|Western',  
'KI'=> 'Abaiang|Abemama|Aranuka|Arorae|Banaba|Banaba|Beru|Butaritari|Central Gilberts|Gilbert Islands|Kanton|Kiritimati|Kuria|Line Islands|Line Islands|Maiana|Makin|Marakei|Nikunau|Nonouti|Northern Gilberts|Onotoa|Phoenix Islands|Southern Gilberts|Tabiteuea|Tabuaeran|Tamana|Tarawa|Tarawa|Teraina',  

 
 'KP'=> "Chagang-do [Chagang Province]|Hamgyong-bukto [North Hamgyong Province]|Hamgyong-namdo [South Hamgyong Province]|Hwanghae-bukto [North Hwanghae Province]|Hwanghae-namdo [South Hwanghae Province]|Kaesong-si [Kaesong City]|Kangwon-do [Kangwon Province]|Namp'o-si [Namp'o City]|P'yongan-bukto [North P'yongan Province]|P'yongan-namdo [South P'yongan Province]|P'yongyang-si [P'yongyang City]|Yanggang-do [Yanggang Province]",  
'KR'=> "Ch'ungch'ong-bukto|Ch'ungch'ong-namdo|Cheju-do|Cholla-bukto|Cholla-namdo|Inch'on-gwangyoksi|Kangwon-do|Kwangju-gwangyoksi|Kyonggi-do|Kyongsang-bukto|Kyongsang-namdo|Pusan-gwangyoksi|Soul-t'ukpyolsi|Taegu-gwangyoksi|Taejon-gwangyoksi|Ulsan-gwangyoksi",  
'KW'=> "Al 'Asimah|Al Ahmadi|Al Farwaniyah|Al Jahra'|Hawalli",  
'KG'=> 'Batken Oblasty|Bishkek Shaary|Chuy Oblasty [Bishkek]|Jalal-Abad Oblasty|Naryn Oblasty|Osh Oblasty|Talas Oblasty|Ysyk-Kol Oblasty [Karakol]',  
'LA'=> 'Attapu|Bokeo|Bolikhamxai|Champasak|Houaphan|Khammouan|Louangnamtha|Louangphabang|Oudomxai|Phongsali|Salavan|Savannakhet|Viangchan|Viangchan|Xaignabouli|Xaisomboun|Xekong|Xiangkhoang',  
 
'LV'=> 'Aizkraukles Rajons|Aluksnes Rajons|Balvu Rajons|Bauskas Rajons|Cesu Rajons|Daugavpils|Daugavpils Rajons|Dobeles Rajons|Gulbenes Rajons|Jekabpils Rajons|Jelgava|Jelgavas Rajons|Jurmala|Kraslavas Rajons|Kuldigas Rajons|Leipaja|Liepajas Rajons|Limbazu Rajons|Ludzas Rajons|Madonas Rajons|Ogres Rajons|Preilu Rajons|Rezekne|Rezeknes Rajons|Riga|Rigas Rajons|Saldus Rajons|Talsu Rajons|Tukuma Rajons|Valkas Rajons|Valmieras Rajons|Ventspils|Ventspils Rajons',  
'LB'=> 'Beyrouth|Ech Chimal|Ej Jnoub|El Bekaa|Jabal Loubnane',  
'LS'=> "Berea|Butha-Buthe|Leribe|Mafeteng|Maseru|Mohales Hoek|Mokhotlong|Qacha's Nek|Quthing|Thaba-Tseka", 
'LR'=> 'Bomi|Bong|Grand Bassa|Grand Cape Mount|Grand Gedeh|Grand Kru|Lofa|Margibi|Maryland|Montserrado|Nimba|River Cess|Sinoe', 
'LY' => "Ajdabiya|Al 'Aziziyah|Al Fatih|Al Jabal al Akhdar|Al Jufrah|Al Khums|Al Kufrah|An Nuqat al Khams|Ash Shati'|Awbari|Az Zawiyah|Banghazi|Darnah|Ghadamis|Gharyan|Misratah|Murzuq|Sabha|Sawfajjin|Surt|Tarabulus|Tarhunah|Tubruq|Yafran|Zlitan",  
'LI'=> 'Balzers|Eschen|Gamprin|Mauren|Planken|Ruggell|Schaan|Schellenberg|Triesen|Triesenberg|Vaduz',  
'LT'=> 'Akmenes Rajonas|Alytaus Rajonas|Alytus|Anyksciu Rajonas|Birstonas|Birzu Rajonas|Druskininkai|Ignalinos Rajonas|Jonavos Rajonas|Joniskio Rajonas|Jurbarko Rajonas|Kaisiadoriu Rajonas|Kaunas|Kauno Rajonas|Kedainiu Rajonas|Kelmes Rajonas|Klaipeda|Klaipedos Rajonas|Kretingos Rajonas|Kupiskio Rajonas|Lazdiju Rajonas|Marijampole|Marijampoles Rajonas|Mazeikiu Rajonas|Moletu Rajonas|Neringa Pakruojo Rajonas|Palanga|Panevezio Rajonas|Panevezys|Pasvalio Rajonas|Plunges Rajonas|Prienu Rajonas|Radviliskio Rajonas|Raseiniu Rajonas|Rokiskio Rajonas|Sakiu Rajonas|Salcininku Rajonas|Siauliai|Siauliu Rajonas|Silales Rajonas|Silutes Rajonas|Sirvintu Rajonas|Skuodo Rajonas|Svencioniu Rajonas|Taurages Rajonas|Telsiu Rajonas|Traku Rajonas|Ukmerges Rajonas|Utenos Rajonas|Varenos Rajonas|Vilkaviskio Rajonas|Vilniaus Rajonas|Vilnius|Zarasu Rajonas', 

'LU'=> 'Diekirch|Grevenmacher|Luxembourg', 
'MO'=> 'Macao', 
'MK'=> 'Aracinovo|Bac|Belcista|Berovo|Bistrica|Bitola|Blatec|Bogdanci|Bogomila|Bogovinje|Bosilovo|Brvenica|Cair [Skopje]|Capari|Caska|Cegrane|Centar [Skopje]|Centar Zupa|Cesinovo|Cucer-Sandevo|Debar|Delcevo|Delogozdi|Demir Hisar|Demir Kapija|Dobrusevo|Dolna Banjica|Dolneni|Dorce Petrov [Skopje]|Drugovo|Dzepciste|Gazi Baba [Skopje]|Gevgelija|Gostivar|Gradsko|Ilinden|Izvor|Jegunovce|Kamenjane|Karbinci|Karpos [Skopje]|Kavadarci|Kicevo|Kisela Voda [Skopje]|Klecevce|Kocani|Konce|Kondovo|Konopiste|Kosel|Kratovo|Kriva Palanka|Krivogastani|Krusevo|Kuklis|Kukurecani|Kumanovo|Labunista|Lipkovo|Lozovo|Lukovo|Makedonska Kamenica|Makedonski Brod|Mavrovi Anovi|Meseista|Miravci|Mogila|Murtino|Negotino|Negotino-Poloska|Novaci|Novo Selo|Oblesevo|Ohrid|Orasac|Orizari|Oslomej|Pehcevo|Petrovec|Plasnia|Podares|Prilep|Probistip|Radovis|Rankovce|Resen|Rosoman|Rostusa|Samokov|Saraj|Sipkovica|Sopiste|Sopotnika|Srbinovo|Star Dojran|Staravina|Staro Nagoricane|Stip|Struga|Strumica|Studenicani|Suto Orizari [Skopje]|Sveti Nikole|Tearce|Tetovo|Topolcani|Valandovo|Vasilevo|Veles|Velesta|Vevcani|Vinica|Vitoliste|Vranestica|Vrapciste|Vratnica|Vrutok|Zajas|Zelenikovo|Zileno|Zitose|Zletovo|Zrnovci', 
'MG'=> 'Antananarivo|Antsiranana|Fianarantsoa|Mahajanga|Toamasina|Toliara',  
'MW'=> 'Balaka|Blantyre|Chikwawa|Chiradzulu|Chitipa|Dedza|Dowa|Karonga|Kasungu|Likoma|Lilongwe|Machinga [Kasupe]|Mangochi|Mchinji|Mulanje|Mwanza|Mzimba|Nkhata Bay|Nkhotakota|Nsanje|Ntcheu|Ntchisi|Phalombe|Rumphi|Salima|Thyolo|Zomba', 
'MY'=> 'Johor|Kedah|Kelantan|Labuan|Melaka|Negeri Sembilan|Pahang|Perak|Perlis|Pulau Pinang|Sabah|Sarawak|Selangor|Terengganu|Wilayah Persekutuan',  
'MV'=> 'Alifu|Baa|Dhaalu|Faafu|Gaafu Alifu|Gaafu Dhaalu|Gnaviyani|Haa Alifu|Haa Dhaalu|Kaafu|Laamu|Lhaviyani|Maale|Meemu|Noonu|Raa|Seenu|Shaviyani|Thaa|Vaavu',  
'ML'=> 'Gao|Kayes|Kidal|Koulikoro|Mopti|Segou|Sikasso|Tombouctou',  
'MT'=> 'Valletta',  
'MH'=> 'Ailinginae|Ailinglaplap|Ailuk|Arno|Aur|Bikar|Bikini|Bokak|Ebon|Enewetak|Erikub|Jabat|Jaluit|Jemo|Kili|Kwajalein|Lae|Lib|Likiep|Majuro|Maloelap|Mejit|Mili|Namorik|Namu|Rongelap|Rongrik|Toke|Ujae|Ujelang|Utirik|Wotho|Wotje', 
'MQ'=> 'Martinique', 
'MR'=> 'Adrar|Assaba|Brakna|Dakhlet Nouadhibou|Gorgol|Guidimaka|Hodh Ech Chargui|Hodh El Gharbi|Inchiri|Nouakchott|Tagant|Tiris Zemmour|Trarza', 
'MU'=> 'Agalega Islands|Black River|Cargados Carajos Shoals|Flacq|Grand Port|Moka|Pamplemousses|Plaines Wilhems|Port Louis|Riviere du Rempart|Rodrigues|Savanne', 
'YT'=> 'Mayotte', 
'MX'=> 'Aguascalientes|Baja California|Baja California Sur|Campeche|Chiapas|Chihuahua|Coahuila de Zaragoza|Colima|Distrito Federal|Durango|Guanajuato|Guerrero|Hidalgo|Jalisco|Mexico|Michoacan de Ocampo|Morelos|Nayarit|Nuevo Leon|Oaxaca|Puebla|Queretaro de Arteaga|Quintana Roo|San Luis Potosi|Sinaloa|Sonora|Tabasco|Tamaulipas|Tlaxcala|Veracruz-Llave|Yucatan|Zacatecas',  
'FM' => 'Chuuk [Truk]|Kosrae|Pohnpei|Yap',  
'MD'=> 'Balti|Cahul|Chisinau|Chisinau|Dubasari|Edinet|Gagauzia|Lapusna|Orhei|Soroca|Tighina|Ungheni', 
'MC'=> 'Fontvieille|La Condamine|Monaco-Ville|Monte-Carlo', 
'MN'=> 'Arhangay|Bayan-Olgiy|Bayanhongor|Bulgan|Darhan|Dornod|Dornogovi|Dundgovi|Dzavhan|Erdenet|Govi-Altay|Hentiy|Hovd|Hovsgol|Omnogovi|Ovorhangay|Selenge|Suhbaatar|Tov|Ulaanbaatar|Uvs',  

'ME'=> 'Montenegro', 
'MS'=> "Saint Anthony|Saint Georges|Saint Peter's",  
'MA'=> 'Agadir|Al Hoceima|Azilal|Ben Slimane|Beni Mellal|Boulemane|Casablanca|Chaouen|El Jadida|El Kelaa des Srarhna|Er Rachidia|Essaouira|Fes|Figuig|Guelmim|Ifrane|Kenitra|Khemisset|Khenifra|Khouribga|Laayoune|Larache|Marrakech|Meknes|Nador|Ouarzazate|Oujda|Rabat-Sale|Safi|Settat|Sidi Kacem|Tan-Tan|Tanger|Taounate|Taroudannt|Tata|Taza|Tetouan|Tiznit', 
'MZ'=> 'Cabo Delgado|Gaza|Inhambane|Manica|Maputo|Nampula|Niassa|Sofala|Tete|Zambezia',  
'MM'=> 'Ayeyarwady|Bago|Chin State|Kachin State|Kayah State|Kayin State|Magway|Mandalay|Mon State|Rakhine State|Sagaing|Shan State|Tanintharyi|Yangon', 
'NA'=> 'Caprivi|Erongo|Hardap|Karas|Khomas|Kunene|Ohangwena|Okavango|Omaheke|Omusati|Oshana|Oshikoto|Otjozondjupa', 
'NR'=>  'Aiwo|Anabar|Anetan|Anibare|Baiti|Boe|Buada|Denigomodu|Ewa|Ijuw|Meneng|Nibok|Uaboe|Yaren', 
'NP'=> 'Bagmati|Bheri|Dhawalagiri|Gandaki|Janakpur|Karnali|Kosi|Lumbini|Mahakali|Mechi|Narayani|Rapti|Sagarmatha|Seti', 
'NL'=>  'Drenthe|Flevoland|Friesland|Gelderland|Groningen|Limburg|Noord-Brabant|Noord-Holland|Overijssel|Utrecht|Zeeland|Zuid-Holland', 
'NC'=> 'Iles Loyaute|Nord|Sud', 
 


'NZ'   => "Akaroa|Amuri|Ashburton|Bay of Islands|Bruce|Buller|Chatham Islands|Cheviot|Clifton|Clutha|Cook|Dannevirke|Egmont|Eketahuna|Ellesmere|Eltham|Eyre|Featherston|Franklin|Golden Bay|Great Barrier Island|Grey|Hauraki Plains|Hawera|Hawke's Bay|Heathcote|Hikurangi|Hobson|Hokianga|Horowhenua|Hurunui|Hutt|Inangahua|Inglewood|Kaikoura|Kairanga|Kiwitea|Lake|Mackenzie|Malvern|Manaia|Manawatu|Mangonui|Maniototo|Marlborough|Masterton|Matamata|Mount Herbert|Ohinemuri|Opotiki|Oroua|Otamatea|Otorohanga|Oxford|Pahiatua|Paparua|Patea|Piako|Pohangina|Raglan|Rangiora|Rangitikei|Rodney|Rotorua|Runanga|Saint Kilda|Silverpeaks|Southland|Stewart Island|Stratford|Strathallan|Taranaki|Taumarunui|Taupo|Tauranga|Thames-Coromandel|Tuapeka|Vincent|Waiapu|Waiheke|Waihemo|Waikato|Waikohu|Waimairi|Waimarino|Waimate|Waimate West|Waimea|Waipa|Waipawa|Waipukurau|Wairarapa South|Wairewa|Wairoa|Waitaki|Waitomo|Waitotara|Wallace|Wanganui|Waverley|Westland|Whakatane|Whangarei|Whangaroa|Woodville", 
'NI' => 'Atlantico Norte|Atlantico Sur|Boaco|Carazo|Chinandega|Chontales|Esteli|Granada|Jinotega|Leon|Madriz|Managua|Masaya|Matagalpa|Nueva Segovia|Rio San Juan|Rivas', 
'NE' => 'Agadez|Diffa|Dosso|Maradi|Niamey|Tahoua|Tillaberi|Zinder', 
'NG' => 'Abia|Abuja Federal Capital Territory|Adamawa|Akwa Ibom|Anambra|Bauchi|Bayelsa|Benue|Borno|Cross River|Delta|Ebonyi|Edo|Ekiti|Enugu|Gombe|Imo|Jigawa|Kaduna|Kano|Katsina|Kebbi|Kogi|Kwara|Lagos|Nassarawa|Niger|Ogun|Ondo|Osun|Oyo|Plateau|Rivers|Sokoto|Taraba|Yobe|Zamfara', 
'NU' =>  'Niue',  
'NF' => 'Norfolk Island',  
'MP' => 'Northern Islands|Rota|Saipan|Tinian',  
'NO' => 'Akershus|Aust-Agder|Buskerud|Finnmark|Hedmark|Hordaland|More og Romsdal|Nord-Trondelag|Nordland|Oppland|Oslo|Ostfold|Rogaland|Sogn og Fjordane|Sor-Trondelag|Telemark|Troms|Vest-Agder|Vestfold',  
'OM' => 'Ad Dakhiliyah|Al Batinah|Al Wusta|Ash Sharqiyah|Az Zahirah|Masqat|Musandam|Zufar',  
'PK' => 'Balochistan|Federally Administered Tribal Areas|Islamabad Capital Territory|North-West Frontier Province|Punjab|Sindh',  
'PW' => 'Aimeliik|Airai|Angaur|Hatobohei|Kayangel|Koror|Melekeok|Ngaraard|Ngarchelong|Ngardmau|Ngatpang|Ngchesar|Ngeremlengui|Ngiwal|Palau Island|Peleliu|Sonsoral|Tobi',  
'PS' => 'West Bank|Gaza Strip',  
'PA' => 'Bocas del Toro|Chiriqui|Cocle|Colon|Darien|Herrera|Los Santos|Panama|San Blas|Veraguas', 
'PG' => 'Bougainville|Central|Chimbu|East New Britain|East Sepik|Eastern Highlands|Enga|Gulf|Madang|Manus|Milne Bay|Morobe|National Capital|New Ireland|Northern|Sandaun|Southern Highlands|West New Britain|Western|Western Highlands',  
'PY' => 'Alto Paraguay|Alto Parana|Amambay|Asuncion [city]|Boqueron|Caaguazu|Caazapa|Canindeyu|Central|Concepcion|Cordillera|Guaira|Itapua|Misiones|Neembucu|Paraguari|Presidente Hayes|San Pedro',  
'PE' => 'Amazonas|Ancash|Apurimac|Arequipa|Ayacucho|Cajamarca|Callao|Cusco|Huancavelica|Huanuco|Ica|Junin|La Libertad|Lambayeque|Lima|Loreto|Madre de Dios|Moquegua|Pasco|Piura|Puno|San Martin|Tacna|Tumbes|Ucayali',  
'PH' => 'Abra|Agusan del Norte|Agusan del Sur|Aklan|Albay|Angeles|Antique|Aurora|Bacolod|Bago|Baguio|Bais|Basilan|Basilan City|Bataan|Batanes|Batangas|Batangas City|Benguet|Bohol|Bukidnon|Bulacan|Butuan|Cabanatuan|Cadiz|Cagayan|Cagayan de Oro|Calbayog|Caloocan|Camarines Norte|Camarines Sur|Camiguin|Canlaon|Capiz|Catanduanes|Cavite|Cavite City|Cebu|Cebu City|Cotabato|Dagupan|Danao|Dapitan|Davao City Davao|Davao del Sur|Davao Oriental|Dipolog|Dumaguete|Eastern Samar|General Santos|Gingoog|Ifugao|Iligan|Ilocos Norte|Ilocos Sur|Iloilo|Iloilo City|Iriga|Isabela|Kalinga-Apayao|La Carlota|La Union|Laguna|Lanao del Norte|Lanao del Sur|Laoag|Lapu-Lapu|Legaspi|Leyte|Lipa|Lucena|Maguindanao|Mandaue|Manila|Marawi|Marinduque|Masbate|Mindoro Occidental|Mindoro Oriental|Misamis Occidental|Misamis Oriental|Mountain|Naga|Negros Occidental|Negros Oriental|North Cotabato|Northern Samar|Nueva Ecija|Nueva Vizcaya|Olongapo|Ormoc|Oroquieta|Ozamis|Pagadian|Palawan|Palayan|Pampanga|Pangasinan|Pasay|Puerto Princesa|Quezon|Quezon City|Quirino|Rizal|Romblon|Roxas|Samar|San Carlos [in Negros Occidental]|San Carlos [in Pangasinan]|San Jose|San Pablo|Silay|Siquijor|Sorsogon|South Cotabato|Southern Leyte|Sultan Kudarat|Sulu|Surigao|Surigao del Norte|Surigao del Sur|Tacloban|Tagaytay|Tagbilaran|Tangub|Tarlac|Tawitawi|Toledo|Trece Martires|Zambales|Zamboanga|Zamboanga del Norte|Zamboanga del Sur',  
'PN' => 'Pitcarin Islands',  
'PL' => 'Dolnoslaskie|Kujawsko-Pomorskie|Lodzkie|Lubelskie|Lubuskie|Malopolskie|Mazowieckie|Opolskie|Podkarpackie|Podlaskie|Pomorskie|Slaskie|Swietokrzyskie|Warminsko-Mazurskie|Wielkopolskie|Zachodniopomorskie', 
'PT' => 'Acores [Azores]|Aveiro|Beja|Braga|Braganca|Castelo Branco|Coimbra|Evora|Faro|Guarda|Leiria|Lisboa|Madeira|Portalegre|Porto|Santarem|Setubal|Viana do Castelo|Vila Real|Viseu', 
'PR' => 'Adjuntas|Aguada|Aguadilla|Aguas Buenas|Aibonito|Anasco|Arecibo|Arroyo|Barceloneta|Barranquitas|Bayamon|Cabo Rojo|Caguas|Camuy|Canovanas|Carolina|Catano|Cayey|Ceiba|Ciales|Cidra|Coamo|Comerio|Corozal|Culebra|Dorado|Fajardo|Florida|Guanica|Guayama|Guayanilla|Guaynabo|Gurabo|Hatillo|Hormigueros|Humacao|Isabela|Jayuya|Juana Diaz|Juncos|Lajas|Lares|Las Marias|Las Piedras|Loiza|Luquillo|Manati|Maricao|Maunabo|Mayaguez|Moca|Morovis|Naguabo|Naranjito|Orocovis|Patillas|Penuelas|Ponce|Quebradillas|Rincon|Rio Grande|Sabana Grande|Salinas|San German|San Juan|San Lorenzo|San Sebastian|Santa Isabel|Toa Alta|Toa Baja|Trujillo Alto|Utuado|Vega Alta|Vega Baja|Vieques|Villalba|Yabucoa|Yauco', 
'QA' => 'Ad Dawhah|Al Ghuwayriyah|Al Jumayliyah|Al Khawr|Al Wakrah|Ar Rayyan|Jarayan al Batinah|Madinat ash Shamal|Umm Salal', 
'RE' => 'Reunion',  
'RO' => 'Alba|Arad|Arges|Bacau|Bihor|Bistrita-Nasaud|Botosani|Braila|Brasov|Bucuresti|Buzau|Calarasi|Caras-Severin|Cluj|Constanta|Covasna|Dimbovita|Dolj|Galati|Giurgiu|Gorj|Harghita|Hunedoara|Ialomita|Iasi|Maramures|Mehedinti|Mures|Neamt|Olt|Prahova|Salaj|Satu Mare|Sibiu|Suceava|Teleorman|Timis|Tulcea|Vaslui|Vilcea|Vrancea',  
'RU' => 'Moscow|Saint Petersburg|Novosibirsk|Yekaterinburg|Nizhny Novgorod|Samara|Kazan|Omsk|Chelyabinsk|Rostov-on-Don|Ufa|Volgograd|Perm|Krasnoyarsk|Voronezh|Saratov|Tolyatti|Krasnodar|Izhevsk|Yaroslavl',  
'RW' => 'Butare|Byumba|Cyangugu|Gikongoro|Gisenyi|Gitarama|Kibungo|Kibuye|Kigali Rurale|Kigali-ville|Ruhengeri|Umutara', 
'BL' => 'Saint Barthelemy',  
'SH' => 'Ascension|Saint Helena|Tristan da Cunha', 
'KN' => 'Christ Church Nichola Town|Saint Anne Sandy Point|Saint George Basseterre|Saint George Gingerland|Saint James Windward|Saint John Capisterre|Saint John Figtree|Saint Mary Cayon|Saint Paul Capisterre|Saint Paul Charlestown|Saint Peter Basseterre|Saint Thomas Lowland|Saint Thomas Middle Island|Trinity Palmetto Point',  
'LC' => 'Anse-la-Raye|Castries|Choiseul|Dauphin|Dennery|Gros Islet|Laborie|Micoud|Praslin|Soufriere|Vieux Fort', 
'MF' => 'Saint Martin [French part]', 
'PM' => 'Miquelon|Saint Pierre', 
'VC' => 'Charlotte|Grenadines|Saint Andrew|Saint David|Saint George|Saint Patrick',
'WS' => "A'ana|Aiga-i-le-Tai|Atua|Fa'asaleleaga|Gaga'emauga|Gagaifomauga|Palauli|Satupa'itea|Tuamasaga|Va'a-o-Fonoti|Vaisigano",  
'SM' => 'Acquaviva|Borgo Maggiore|Chiesanuova|Domagnano|Faetano|Fiorentino|Monte Giardino|San Marino|Serravalle', 
'ST' => 'Principe|Sao Tome',  
'SA' => "'Asir|Al Bahah|Al Hudud ash Shamaliyah|Al Jawf|Al Madinah|Al Qasim|Ar Riyad|Ash Sharqiyah [Eastern Province]|Ha'il|Jizan|Makkah|Najran|Tabuk",  
'SN' => 'Dakar|Diourbel|Fatick|Kaolack|Kolda|Louga|Saint-Louis|Tambacounda|Thies|Ziguinchor',  
'RS' => 'Serbia', 
'SC' => "Anse aux Pins|Anse Boileau|Anse Etoile|Anse Louis|Anse Royale|Baie Lazare|Baie Sainte Anne|Beau Vallon|Bel Air|Bel Ombre|Cascade|Glacis|Grand' Anse [on Mahe]|Grand' Anse [on Praslin]|La Digue|La Riviere Anglaise|Mont Buxton|Mont Fleuri|Plaisance|Pointe La Rue|Port Glaud|Saint Louis|Takamaka",  
'SL' => 'Eastern|Northern|Southern|Western',  
'SG' => 'Singapore',  
'SX' => 'Sint Maarten [Dutch part]',  
'SK' => 'Banskobystricky|Bratislavsky|Kosicky|Nitriansky|Presovsky|Trenciansky|Trnavsky|Zilinsky',  
'SI' => 'Ajdovscina|Beltinci|Bled|Bohinj|Borovnica|Bovec|Brda|Brezice|Brezovica|Cankova-Tisina|Celje|Cerklje na Gorenjskem|Cerknica|Cerkno|Crensovci|Crna na Koroskem|Crnomelj|Destrnik-Trnovska Vas|Divaca|Dobrepolje|Dobrova-Horjul-Polhov Gradec|Dol pri Ljubljani|Domzale|Dornava|Dravograd|Duplek|Gorenja Vas-Poljane|Gorisnica|Gornja Radgona|Gornji Grad|Gornji Petrovci|Grosuplje|Hodos Salovci|Hrastnik|Hrpelje-Kozina|Idrija|Ig|Ilirska Bistrica|Ivancna Gorica|Izola|Jesenice|Jursinci|Kamnik|Kanal|Kidricevo|Kobarid|Kobilje|Kocevje|Komen|Koper|Kozje|Kranj|Kranjska Gora|Krsko|Kungota|Kuzma|Lasko|Lenart|Lendava|Litija|Ljubljana|Ljubno|Ljutomer|Logatec|Loska Dolina|Loski Potok|Luce|Lukovica|Majsperk|Maribor|Medvode|Menges|Metlika|Mezica|Miren-Kostanjevica|Mislinja|Moravce|Moravske Toplice|Mozirje|Murska Sobota|Muta|Naklo|Nazarje|Nova Gorica|Novo Mesto|Odranci|Ormoz|Osilnica|Pesnica|Piran|Pivka|Podcetrtek|Podvelka-Ribnica|Postojna|Preddvor|Ptuj|Puconci|Race-Fram|Radece|Radenci|Radlje ob Dravi|Radovljica|Ravne-Prevalje|Ribnica|Rogasevci|Rogaska Slatina|Rogatec|Ruse|Semic|Sencur|Sentilj|Sentjernej|Sentjur pri Celju|Sevnica|Sezana|Skocjan|Skofja Loka|Skofljica|Slovenj Gradec|Slovenska Bistrica|Slovenske Konjice|Smarje pri Jelsah|Smartno ob Paki|Sostanj|Starse|Store|Sveti Jurij|Tolmin|Trbovlje|Trebnje|Trzic|Turnisce|Velenje|Velike Lasce|Videm|Vipava|Vitanje|Vodice|Vojnik|Vrhnika|Vuzenica|Zagorje ob Savi|Zalec|Zavrc|Zelezniki|Ziri|Zrece',  
'SB' => 'Bellona|Central|Choiseul [Lauru]|Guadalcanal|Honiara|Isabel|Makira|Malaita|Rennell|Temotu|Western',  
'SO' => 'Awdal|Bakool|Banaadir|Bari|Bay|Galguduud|Gedo|Hiiraan|Jubbada Dhexe|Jubbada Hoose|Mudug|Nugaal|Sanaag|Shabeellaha Dhexe|Shabeellaha Hoose|Sool|Togdheer|Woqooyi Galbeed',  
'ZA' => 'Eastern Cape|Free State|Gauteng|KwaZulu-Natal|Limpopo|Mpumalanga|North West|Northern Cape|Western Cape',  
'GS' => 'Bird Island|Bristol Island|Clerke Rocks|Montagu Island|Saunders Island|South Georgia|Southern Thule|Traversay Islands',  
'SS' => 'South Sudan',  
'ES' => 'Albacete|Alicante|Almer\xeda|Asturias|Badajoz|Balearic Islands|Barcelona|Biscay|Burgos|Cantabria|Castell\xf3n|Ciudad Real|Cuenca|C\xe1ceres|C\xe1diz|C\xf3rdoba|Gerona|Granada|Guadalajara|Guip\xfazcoa|Huelva|Huesca|Ja\xe9n|La Coru\xf1a|La Rioja|Las Palmas|Le\xf3n|Lugo|L\xe9rida|Madrid|Murcia|M\xe1laga|Navarre|Orense|Palencia|Pontevedra|Salamanca|Santa Cruz|Segovia|Sevilla|Soria|Tarragona|Teruel|Toledo|Valencia|Valladolid|Zamora|Zaragoza|\xc1lava|\xc1vila',  
'LK' => 'Central|Eastern|North Central|North Eastern|North Western|Northern|Sabaragamuwa|Southern|Uva|Western',  
'SD' => "A'ali an Nil|Al Bahr al Ahmar|Al Buhayrat|Al Jazirah|Al Khartum|Al Qadarif|Al Wahdah|An Nil al Abyad|An Nil al Azraq|Ash Shamaliyah|Bahr al Jabal|Gharb al Istiwa'iyah|Gharb Bahr al Ghazal|Gharb Darfur|Gharb Kurdufan|Janub Darfur|Janub Kurdufan|Junqali|Kassala|Nahr an Nil|Shamal Bahr al Ghazal|Shamal Darfur|Shamal Kurdufan|Sharq al Istiwa'iyah|Sinnar|Warab",  
'SR' => 'Brokopondo|Commewijne|Coronie|Marowijne|Nickerie|Para|Paramaribo|Saramacca|Sipaliwini|Wanica', 
'SJ' => 'Barentsoya|Bjornoya|Edgeoya|Hopen|Kvitoya|Nordaustandet|Prins Karls Forland|Spitsbergen',  
'SZ' => 'Hhohho|Lubombo|Manzini|Shiselweni',  
'SE' => 'Blekinge|Dalarnas|Gavleborgs|Gotlands|Hallands|Jamtlands|Jonkopings|Kalmar|Kronobergs|Norrbottens|Orebro|Ostergotlands|Skane|Sodermanlands|Stockholms|Uppsala|Varmlands|Vasterbottens|Vasternorrlands|Vastmanlands|Vastra Gotalands', 
'CH' => 'Aargau|Ausser-Rhoden|Basel-Landschaft|Basel-Stadt|Bern|Fribourg|Geneve|Glarus|Graubunden|Inner-Rhoden|Jura|Luzern|Neuchatel|Nidwalden|Obwalden|Sankt Gallen|Schaffhausen|Schwyz|Solothurn|Thurgau|Ticino|Uri|Valais|Vaud|Zug|Zurich',  
'SY' => "Al Hasakah|Al Ladhiqiyah|Al Qunaytirah|Ar Raqqah|As Suwayda'|Dar'a|Dayr az Zawr|Dimashq|Halab|Hamah|Hims|Idlib|Rif Dimashq|Tartus",  
'TW' => "Chang-hua|Chi-lung|Chia-i|Chia-i|Chung-hsing-hsin-ts'un|Hsin-chu|Hsin-chu|Hua-lien|I-lan|Kao-hsiung|Kao-hsiung|Miao-li|Nan-t'ou|P'eng-hu|P'ing-tung|T'ai-chung|T'ai-chung|T'ai-nan|T'ai-nan|T'ai-pei|T'ai-pei|T'ai-tung|T'ao-yuan|Yun-lin", 
'TJ' => 'Viloyati Khatlon|Viloyati Leninobod|Viloyati Mukhtori Kuhistoni Badakhshon',  
'TZ' => 'Arusha|Dar es Salaam|Dodoma|Iringa|Kagera|Kigoma|Kilimanjaro|Lindi|Mara|Mbeya|Morogoro|Mtwara|Mwanza|Pemba North|Pemba South|Pwani|Rukwa|Ruvuma|Shinyanga|Singida|Tabora|Tanga|Zanzibar Central/South|Zanzibar North|Zanzibar Urban/West', 
'TH' => 'Amnat Charoen|Ang Thong|Buriram|Chachoengsao|Chai Nat|Chaiyaphum|Chanthaburi|Chiang Mai|Chiang Rai|Chon Buri|Chumphon|Kalasin|Kamphaeng Phet|Kanchanaburi|Khon Kaen|Krabi|Krung Thep Mahanakhon [Bangkok]|Lampang|Lamphun|Loei|Lop Buri|Mae Hong Son|Maha Sarakham|Mukdahan|Nakhon Nayok|Nakhon Pathom|Nakhon Phanom|Nakhon Ratchasima|Nakhon Sawan|Nakhon Si Thammarat|Nan|Narathiwat|Nong Bua Lamphu|Nong Khai|Nonthaburi|Pathum Thani|Pattani|Phangnga|Phatthalung|Phayao|Phetchabun|Phetchaburi|Phichit|Phitsanulok|Phra Nakhon Si Ayutthaya|Phrae|Phuket|Prachin Buri|Prachuap Khiri Khan|Ranong|Ratchaburi|Rayong|Roi Et|Sa Kaeo|Sakon Nakhon|Samut Prakan|Samut Sakhon|Samut Songkhram|Sara Buri|Satun|Sing Buri|Sisaket|Songkhla|Sukhothai|Suphan Buri|Surat Thani|Surin|Tak|Trang|Trat|Ubon Ratchathani|Udon Thani|Uthai Thani|Uttaradit|Yala|Yasothon',  
'Timor-Leste', 
'TG' => 'De La Kara|Des Plateaux|Des Savanes|Du Centre|Maritime', 
'TK' => 'Atafu|Fakaofo|Nukunonu',  
'TO' => "Ha'apai|Tongatapu|Vava'u", 
'TT' =>  'Arima|Caroni|Mayaro|Nariva|Port-of-Spain|Saint Andrew|Saint David|Saint George|Saint Patrick|San Fernando|Victoria|Tobago', 
'TN' => 'Ariana|Beja|Ben Arous|Bizerte|El Kef|Gabes|Gafsa|Jendouba|Kairouan|Kasserine|Kebili|Mahdia|Medenine|Monastir|Nabeul|Sfax|Sidi Bou Zid|Siliana|Sousse|Tataouine|Tozeur|Tunis|Zaghouan',  
 'TR' => 'Adana|Adiyaman|Afyon|Agri|Aksaray|Amasya|Ankara|Antalya|Ardahan|Artvin|Aydin|Balikesir|Bartin|Batman|Bayburt|Bilecik|Bingol|Bitlis|Bolu|Burdur|Bursa|Canakkale|Cankiri|Corum|Denizli|Diyarbakir|Duzce|Edirne|Elazig|Erzincan|Erzurum|Eskisehir|Gaziantep|Giresun|Gumushane|Hakkari|Hatay|Icel|Igdir|Isparta|Istanbul|Izmir|Kahramanmaras|Karabuk|Karaman|Kars|Kastamonu|Kayseri|Kilis|Kirikkale|Kirklareli|Kirsehir|Kocaeli|Konya|Kutahya|Malatya|Manisa|Mardin|Mugla|Mus|Nevsehir|Nigde|Ordu|Osmaniye|Rize|Sakarya|Samsun|Sanliurfa|Siirt|Sinop|Sirnak|Sivas|Tekirdag|Tokat|Trabzon|Tunceli|Usak|Van|Yalova|Yozgat|Zonguldak',  
'TM' => 'Ahal Welayaty|Balkan Welayaty|Dashhowuz Welayaty|Lebap Welayaty|Mary Welayaty',  
'TC' => 'Turks and Caicos Islands',  
'TV' => 'Tuvalu',  
'UG' => 'Adjumani|Apac|Arua|Bugiri|Bundibugyo|Bushenyi|Busia|Gulu|Hoima|Iganga|Jinja|Kabale|Kabarole|Kalangala|Kampala|Kamuli|Kapchorwa|Kasese|Katakwi|Kibale|Kiboga|Kisoro|Kitgum|Kotido|Kumi|Lira|Luwero|Masaka|Masindi|Mbale|Mbarara|Moroto|Moyo|Mpigi|Mubende|Mukono|Nakasongola|Nebbi|Ntungamo|Pallisa|Rakai|Rukungiri|Sembabule|Soroti|Tororo',  
'UA' => "Avtonomna Respublika Krym [Simferopol']|Cherkas'ka [Cherkasy]|Chernihivs'ka [Chernihiv]|Chernivets'ka [Chernivtsi]|Dnipropetrovs'ka [Dnipropetrovs'k]|Donets'ka [Donets'k]|Ivano-Frankivs'ka [Ivano-Frankivs'k]|Kharkivs'ka [Kharkiv]|Khersons'ka [Kherson]|Khmel'nyts'ka [Khmel'nyts'kyy]|Kirovohrads'ka [Kirovohrad]|Kyyiv|Kyyivs'ka [Kiev]|L'vivs'ka [L'viv]|Luhans'ka [Luhans'k]|Mykolayivs'ka [Mykolayiv]|Odes'ka [Odesa]|Poltavs'ka [Poltava]|Rivnens'ka [Rivne]|Sevastopol'|Sums'ka [Sumy]|Ternopil's'ka [Ternopil']|Vinnyts'ka [Vinnytsya]|Volyns'ka [Luts'k]|Zakarpats'ka [Uzhhorod]|Zaporiz'ka [Zaporizhzhya]|Zhytomyrs'ka [Zhytomyr]",  
'AE' => "'Ajman|Abu Zaby [Abu Dhabi]|Al Fujayrah|Ash Shariqah [Sharjah]|Dubayy [Dubai]|Ra's al Khaymah|Umm al Qaywayn",  

//'GB' => 'England|Northern Ireland|Scotland|Wales',
'GB' => 'Aberdeenshire|Alderney|Angus|Antrim|Argyll|Armagh|Avon|Ayrshire|Banffshire|Bedfordshire|Berkshire|Berwickshire|Blaenau Gwent|Borders|Bridgend|Buckinghamshire|Bute|Caerphilly|Caithness|Cambridgeshire|Cardiff|Carmarthenshire|Central|Ceredigion|Cheshire|Clackmannanshire|Cleveland|Clwyd|Co. Antrim|Co. Armagh|Co. Derry|Co. Down|Co. Fermanagh|Co. Tyrone|Conwy|Cornwall|Cumberland|Cumbria|Denbighshire|Derbyshire|Derry|Devon|Dorset|Down|Dumfries & Galloway|Dumfriesshire|Dunbartonshire|Durham|Dyfed|East Lothian|East Sussex|Essex|Fermanagh|Fife|Flintshire|Gloucestershire|Grampian|Greater London|Greater Manchester|Guernsey|Gwent|Gwynedd|Hampshire|Hereford & Worcester|Herefordshire|Hertfordshire|Highland|Humberside|Huntingdonshire|Inverness|Isle Of Man|Isle of Anglesey|Isle of Wight|Jersey|Kent|Kincardineshire|Kinross-shire|Kirkcudbrightshire|Lanarkshire|Lancashire|Leicestershire|Lincolnshire|Lothian|Merseyside|Merthyr Tydfil|Mid Glamorgan|Middlesex|Midlothian|Monmouthshire|Moray|Nairnshire|Neath Port Talbot|Newport|Norfolk|North Yorkshire|Northamptonshire|Northumberland|Nottinghamshire|Orkney|Oxfordshire|Peebleshire|Pembrokeshire|Perthshire|Powys|Renfrewshire|Rhondda Cynon Taff|Ross & Cromarty|Roxburghshire|Rutland|Scotland|Selkirkshire|Shetland|Shropshire|Somerset|South Glamorgan|South Yorkshire|Staffordshire|Stirlingshire|Strathclyde|Suffolk|Surrey|Sussex|Sutherland|Swansea|Tayside|Torfaen|Tyne & Wear|Tyne and Wear|Tyrone|Vale of Glamorgan|Wales|Warwickshire|West Glamorgan|West Lothian|West Midlands|West Riding|West Sussex|West Yorkshire|Western Isles|Westmoorland|Westmorland|Wigtownshire|Wiltshire|Worcestershire|Wrexham|Yorkshire',
  
'US' => 'Alaska|Alabama|Arkansas|Arizona|California|Colorado|Connecticut|Washington, D.C.|Delaware|Federated States of Micronesia|Florida|Guam|Georgia|Hawaii|Iowa|Idaho|Illinois|Indiana|Kansas|Kentucky|Louisiana|Marshall Islands|Massachusetts|Maryland|Maine|Michigan|Minnesota|Missouri|Mississippi|Montana|North Carolina|Northern Mariana Islands|North Dakota|Nebraska|New Hampshire|New Jersey|New Mexico|Nevada|New York|Ohio|Oklahoma|Oregon|Pennsylvania|Palau|Puerto Rico|Rhode Island|South Carolina|Samoa|South Dakota|Tennessee|Texas|Utah|Virginia|Virgin Islands|Vermont|Washington|Wisconsin|West Virginia|Wyoming', 
'UM' => '', 
'UY' => 'Artigas|Canelones|Cerro Largo|Colonia|Durazno|Flores|Florida|Lavalleja|Maldonado|Montevideo|Paysandu|Rio Negro|Rivera|Rocha|Salto|San Jose|Soriano|Tacuarembo|Treinta y Tres', 
'UZ' => 'Andijon Wiloyati|Bukhoro Wiloyati|Farghona Wiloyati|Jizzakh Wiloyati|Khorazm Wiloyati [Urganch]|Namangan Wiloyati|Nawoiy Wiloyati|Qashqadaryo Wiloyati [Qarshi]|Qoraqalpoghiston [Nukus]|Samarqand Wiloyati|Sirdaryo Wiloyati [Guliston]|Surkhondaryo Wiloyati [Termiz]|Toshkent Shahri|Toshkent Wiloyati', 
'VU' => 'Malampa|Penama|Sanma|Shefa|Tafea|Torba',  
'VE' => 'Amazonas|Anzoategui|Apure|Aragua|Barinas|Bolivar|Carabobo|Cojedes|Delta Amacuro|Dependencias Federales|Distrito Federal|Falcon|Guarico|Lara|Merida|Miranda|Monagas|Nueva Esparta|Portuguesa|Sucre|Tachira|Trujillo|Vargas|Yaracuy|Zulia',  
'VN' => 'An Giang|Ba Ria-Vung Tau|Bac Giang|Bac Kan|Bac Lieu|Bac Ninh|Ben Tre|Binh Dinh|Binh Duong|Binh Phuoc|Binh Thuan|Ca Mau|Can Tho|Cao Bang|Da Nang|Dac Lak|Dong Nai|Dong Thap|Gia Lai|Ha Giang|Ha Nam|Ha Noi|Ha Tay|Ha Tinh|Hai Duong|Hai Phong|Ho Chi Minh|Hoa Binh|Hung Yen|Khanh Hoa|Kien Giang|Kon Tum|Lai Chau|Lam Dong|Lang Son|Lao Cai|Long An|Nam Dinh|Nghe An|Ninh Binh|Ninh Thuan|Phu Tho|Phu Yen|Quang Binh|Quang Nam|Quang Ngai|Quang Ninh|Quang Tri|Soc Trang|Son La|Tay Ninh|Thai Binh|Thai Nguyen|Thanh Hoa|Thua Thien-Hue|Tien Giang|Tra Vinh|Tuyen Quang|Vinh Long|Vinh Phuc|Yen Bai',  
'VG' => 'Anegada|Jost Van Dyke|Tortola|Virgin Gorda',  
'VI' => 'Saint Croix|Saint John|Saint Thomas', 
'WF' => 'Alo|Sigave|Wallis',  
'EH' => 'Western Sahara', 
'YE' => "'Adan|'Ataq|Abyan|Al Bayda'|Al Hudaydah|Al Jawf|Al Mahrah|Al Mahwit|Dhamar|Hadhramawt|Hajjah|Ibb|Lahij|Ma'rib|Sa'dah|San'a'|Ta'izz",  
'ZM' => 'Central|Copperbelt|Eastern|Luapula|Lusaka|North-Western|Northern|Southern|Western',  
'ZW' => 'Bulawayo|Harare|ManicalandMashonaland Central|Mashonaland East|Mashonaland West|Masvingo|Matabeleland North|Matabeleland South|Midlands',  
 
 
 );
class core_search {

    private static $_instance;
 
    function __construct() {
 
        add_action( 'wp_ajax_asw_save_options', array($this, 'save_options') );
	 
    }
 
	
	function build_output_form(){
	
        global $wpdb;

       
        $fields = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}core_search WHERE type='custom' ORDER BY `order` ASC" );         
 
		if(!empty($fields)){

        ob_start();
		
		echo '<div class="card addcheck p-2" style="margin-top:-1px;"><input type="hidden" name="advanced_search" value="1" />';
		
        foreach ($fields as $field) {
				
			// DECODE JASON TITLE
			$titles = json_decode($field->label, true);
			if ( isset($titles['en_us']) && $titles['en_us'] != "" ) {
			 echo "<label class='mb-2 small'>".stripslashes($titles['en_us'])."</label>";
			}

            switch ($field->type) {
            
				case 'custom': {					
				?>
				<div class="row px-3 mb-2">
				<div class="col-10 px-0">
				<?php  echo $this->build_output_customfield($field); ?>
				</div>
				<div class="col-2 px-0">
				<button class="bg-dark btn btn-dark rounded-0 btn-sm ml-2" type="submit"><i class="fa fa-search"></i></button>
				</div>            
				</div>			 
				<?php 
				} break;

                case 'taxonomy':
                     
                    break;

                
				case 'head':
                     
                    break;

                default:
                    break;
            }
        } 
		
		echo '</div>';	

		return ob_get_clean();    
		
		}
}
	
function build_output_customfield($field){ global $CORE, $wpdb;


$field_name =  $field->key;
$selected = isset( $_GET[$field_name] ) ? $_GET[$field_name] : '';

if ( $field->field_type == 'text' ) {
						
						// BEFORE						 
						$es = "";	
						 
						
                        printf( '<input type="text" id="search_id_'.$field_name.'" name="%s" value="%s"  class="form-control form-control-sm" />', $field_name, $selected );
					  	
						
						} else if ( $field->field_type == 'radio' ) {
						  
							
							 $fields = $wpdb->get_results( "SELECT DISTINCT ".$wpdb->postmeta.".meta_value FROM ".$wpdb->postmeta." WHERE ".$wpdb->postmeta.".meta_key = '".$field->key."'");
							  
							 if(is_array($fields)){
								 foreach ($fields as $field) {
								 
								 echo "<div class='radio'><input type='radio' name='".$field_name."' value='".$field->meta_value."' />". $field->meta_value."</div>";
								 
								 }
							 }
							 
						} else if ( $field->field_type == 'multi-select' ) {



							if($field->values == ""){
							
								printf( '<select name="%s[]" class="form-control form-control-sm" multiple=multiple>', $field_name );
								echo $CORE->CUSTOMFIELDLIST($field->key,$selected);
								echo '</select>';
							
							}else{
							
								$options = explode( PHP_EOL, $field->values );
								
								printf( '<select name="%s[]" class="form-control form-control-sm" multiple=multiple>', $field_name );
								foreach ($options as $option) {
								
									// CHECK IF WE HAVE A CUSTOM TEXT OPTION
									$v = explode("[",$option);
									if(isset($v[1]) && strlen($v[1]) > 1){ $display_text = str_replace("]","",$v[1]); }else{ $display_text = $v[0]; }
									
									if(is_array($selected) && !empty($selected)){								 								 
										if(in_array($v[0],$selected) ){ $sel = "selected=selected"; }else{ $sel = ""; } 
									}
									printf( '<option value="%1$s"%3$s>%2$s</option>', trim( $v[0] ), $display_text, $sel );
								}
								echo '</select>';
							
							}
                        	
                        } else if ( $field->field_type == 'select' ) {
							
							
							if($field->values == ""){
							
							printf( '<select name="%s" class="form-control form-control-sm">', $field_name );
							echo '<option value="">&nbsp;&nbsp;</option>';
							echo $this->CUSTOMFIELD_LIST($field->key,$selected);
							echo '</select>';
							
							}else{
                            $options = explode( PHP_EOL, $field->values );
							
                            printf( '<select name="%s" class="form-control form-control-sm">', $field_name );
                            foreach ($options as $option) {
							
								// CHECK IF WE HAVE A CUSTOM TEXT OPTION
								$v = explode("[",$option);
								if(isset($v[1]) && strlen($v[1]) > 1){ $display_text = str_replace("]","",$v[1]); }else{ $display_text = $v[0]; }
								
                                printf( '<option value="%1$s"%3$s>%2$s</option>', trim( $v[0] ), $display_text, selected( $selected, $v[0], false ) );
                            }
                            echo '</select>';
							
							}
                        }


}
	
	

    public static function instance() {
        if ( !self::$_instance ) {
            self::$_instance = new core_search();
        }

        return self::$_instance;
    }
 
 
    function print_r( $param ) {
        echo '<pre>';
        print_r( $param );
        echo '</pre>';
    }
	
	
function CUSTOMFIELD_LIST($field,$selected="",$isTranslation=1){ global $wpdb, $CORE; $STRING = ""; $in_array = array(); $statesArray = array();	
 						
				$SQL = "SELECT DISTINCT ".$wpdb->postmeta.".meta_value FROM ".$wpdb->postmeta." 
				INNER JOIN ".$wpdb->posts." ON (".$wpdb->postmeta.".post_id = ".$wpdb->posts.".ID AND ".$wpdb->posts.".post_type = 'listing_type' AND ".$wpdb->posts.".post_status='publish'  )
				WHERE ".$wpdb->postmeta.".meta_key = ('".strip_tags($field)."') LIMIT 0,100";
				
				if ( WLT_CACHING == false || ( $query = get_transient( 'customfieldlist_query2_'.$field) ) === false   ) {
 
					$query = $wpdb->get_results($SQL, OBJECT);
					set_transient( 'customfieldlist_query2_'.$field, $query, 24 * HOUR_IN_SECONDS );
				}
				
				if(!empty($query)){
				
					// LOOK DATA
					foreach($query as $val){
				 
							// ADD TO ARRAY
							$in_array[] 	= $val->meta_value;
							$statesArray[] .= $val->meta_value;
					 
					}				 						  
					
					// NOW RE-ORDER AND DISPLAY				
					asort($statesArray);					 
					foreach($statesArray as $state){ 
							if(strlen($state) < 2){ continue; }
							if($isTranslation != 1){ $label = $CORE->_e(array($isTranslation,$state)); }else{ $label = $state; }
							
							if($field == "map-country" && isset($GLOBALS['core_country_list'][$state]) ){ $label = $GLOBALS['core_country_list'][$state]; }
							
							if($selected != "" &&  $state == $selected){							
							$STRING .= "<option value='".$state."' selected=selected>". $label."</option>";
							}else{
							$STRING .= "<option value='".$state."'>". $label."</option>";
							} // end if	
					}					
					
				}
				
				return $STRING;	
	
	}
 

    /**
     * Save admin page options with ajax
     *
     * @global object $wpdb
     */
    function save_options() {
	
        global $wpdb;
     
        $posted = $_POST;
    
        //delete all fields when saving
        $wpdb->query( "DELETE FROM {$wpdb->prefix}core_search" );
		if(!isset($posted['csw_field_type']) || ( isset($posted['csw_field_type']) && !is_array($posted['csw_field_type']) ) ){ return; }
		
		
		
		
		
        foreach ($posted['csw_field_type'] as $index => $action) {
            $data = array();
			
			
// BUILD LABEL ARRAY	
$title = array();
$title['en_us'] = $posted['asw_label_en_us'][$index];	

if(is_array(_ppt('languages') )){ 

foreach(_ppt('languages') as $lang){ 

$icon = explode("_",$lang); 

if(isset($icon[1]) && strtolower($icon[1]) == "us"){ continue; } 

if(isset($posted['asw_label_'.strtolower($lang)][$index])){
$title[strtolower($lang)] = $posted['asw_label_'.strtolower($lang)][$index];
}else{
$title[strtolower($lang)] = "";
}


	
} } 

$title = json_encode($title);
 
  
			

            switch ($action) {
                case 'search':
                    $data = array(
                        'type' => 'search',
                        'label' => $title,
						'alias' => $posted['asw_key_alias'][$index],
                        'order' => $index
                    );
                 break;
					
				case 'head':
                    $data = array(
                        'type' => 'head',
                        'label' => $title,
                        'order' => $index,
						'alias' => trim( $posted['asw_key_alias'][$index] ),
                    );
                break;

                case 'custom': {				 
                    $data = array(
                        'type' => 'custom',
                        'label' => $title,
                        'order' => $index,
                        'operator' => $posted['asw_operator'][$index],
                        'compare' => $posted['asw_compare'][$index],
                        'values' => $posted['asw_cs_values'][$index],
                        'key' => trim( $posted['asw_key'][$index] ),
                        'alias' => trim( $posted['asw_key_alias'][$index] ),
                        'field_type' => $posted['asw_cs_type'][$index],
                        'description' => $posted['asw_help'][$index]
                    );
                    
				} break;

                case 'taxonomy': {
                    $data = array(
                        'type' => 'taxonomy',
                        'label' => $title,
                        'order' => $index,
                        'compare' => $posted['asw_compare'][$index],
						'link' => $posted['asw_link'][$index],
                        'key' => $posted['asw_key'][$index],
                        'description' => $posted['asw_help'][$index],
						'alias' => trim( $posted['asw_key_alias'][$index] ),
                    );
 
                    if ( $posted['asw_cs_type'][$index] == 'yes' ) {
                        $data['field_type'] = 'multi';
						
                    }elseif ( $posted['asw_cs_type'][$index] == 'link' ) {
                        $data['field_type'] = 'link';
                    }
				} break;
                default:
                    break;
            }
			 
            $g = $wpdb->insert( $wpdb->prefix . 'core_search', $data );
	  
        }

        //delete transient
        delete_site_transient( 'asw_fields' );
 
    }

    /**
     * Builds an custom field area for search form builder
     *
     * @param null|object $data
     */
    function custom_field( $data = null ) {
	
	global $CORE;
	
        $label = '';
        $meta_key = '';
		$link_key = '';
        $field_type = '';
        $values = '';
        $data_type = '';
        $compare = '';
        $operator = '';
        $help = '';
        $alias = '';
		 
 
        if ( !is_null( $data ) ) {
            $label = $data->label;
            $meta_key = $data->key;
            $field_type = $data->field_type;
			$link_key = $data->link;
            $values = $data->values;
            $operator = $data->operator;
            $compare = $data->compare;
            $help = $data->description;
            $alias = $data->alias;
        }
		
		// DECODE JASON TITLE
		$titles = json_decode($label, true);
		 
        $style = ($field_type == 'select') ? 'block' : 'none';
        ?>
        <li class="cfielditem adsearchbox closed">
        
        <div class="heading">
        
        
        <div class="showhide">
        
        	<a href="javascript:void(0);" rel="tooltip" data-original-title="Delete" data-placement="top" class="asw-remove-el btn btn-primary btn-sm"><i class="fas fa-times" aria-hidden="true"></i></a>
       
            <a href="#" onclick="jQuery('.ssf-<?php if(isset($data->id)){ echo $data->id; }  ?>').fadeToggle();" rel="tooltip" data-original-title="Show/Hide Options" data-placement="top" class="btn btn-primary btn-sm">
            <i class="fa fa-search" aria-hidden="true"></i>
            </a> 
                                         
        </div>  
           
          <div class="name">
            
            
            
            <span class="badge badge-success">Custom Field</span><span>
                    <?php
                    if ( isset($titles['en_us']) ) {
                        echo ' - ' . stripslashes($titles['en_us']);
                    }
                    ?></span>
            </div>
            
            </div>
            <div class="inside clearfix ssf-<?php if(isset($data->id)){ echo $data->id; }  ?>">
            
            <!-------------------- FIELD ---------------------->
            <div class="form-group mb-2">
                <label class="txt500">
                Display Caption
                </label>
                <div class="">
                
              
                  
                  <input type="hidden" name="csw_field_type[]" value="custom" />
                    
                    
                  <input type="text" class="form-control form-control-smrequired"  name="asw_label_en_us[]" id="custom_asw_label_en_us<?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>" value="<?php echo esc_attr( stripslashes($titles['en_us']) ); ?>" />
                  
                    
                    
<?php if(is_array(_ppt('languages') )){   foreach(_ppt('languages') as $lang){ $icon = explode("_",$lang); 

if( isset($icon[1]) && strtolower($icon[1]) == "us"){ continue; } ?>
<div class="input-group my-2"> 
<span class="add-on input-group-prepend"> 

<a href="javascript:void(0);" onclick="ajax_translate(jQuery('#custom_asw_label_en_us<?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>').val(),'en','<?php echo strtolower($lang); ?>','#custom_asw_label_<?php echo strtolower($lang); ?><?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>');">
<div class="flag flag-<?php if(isset($icon[1])){ echo strtolower($icon[1]); }else{ echo $icon[0]; } ?>">&nbsp;</div>
</a>

 
</span>     
<input type="input" name="asw_label_<?php echo strtolower($lang); ?>[]" id="custom_asw_label_<?php echo strtolower($lang); ?><?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>" class="form-control form-control-smrequired" value="<?php if(isset($titles[strtolower($lang)])){ echo esc_attr( stripslashes($titles[strtolower($lang)]) ); } ?>">
</div>    
<?php } } ?>    
                    
                    
                </div>
            </div>
            

                
            
          <!-------------------- FIELD ---------------------->
            <div class="form-group mb-2">
                <label class="txt500">
                Search Field
                </label>
                <div class="">
                  
                  <select  class="form-control" name="asw_key[]" >
                    <?php
					echo $CORE->CUSTOMFIELDLIST(esc_attr( $meta_key ));
					?> 
                    </select>
                </div>
            </div>
            
            <input type="hidden" name="asw_link[]" value="" />
            
           
            <!-------------------- FIELD ---------------------->          
            
            
            
            <input type="hidden" name="asw_help[]" value="" />
            <!-------------------- FIELD ---------------------->
            
            
             <!-------------------- FIELD ---------------------->
            <div class="form-group mb-2">
                <label class="txt500">
               Field Type
                </label>
                <div class="">
                  
                  <select name="asw_cs_type[]" class="form-control">
                        <option value="text"<?php selected( $field_type, 'text' ); ?>>Text</option>
                        <option value="select"<?php selected( $field_type, 'select' ); ?>>Select</option>
                       <!--
                        <option value="multi-select"<?php selected( $field_type, 'multi-select' ); ?>>Multiple Selection</option>                        
                        
                        <option value="radio"<?php selected( $field_type, 'radio' ); ?>>Radio</option>
                        <option value="date"<?php selected( $field_type, 'date' ); ?>>Date</option>
                        <option value="date-range"<?php selected( $field_type, 'date-range' ); ?>>Date (range)</option>-->
                    </select>
                </div>
            </div>
         
            <!-------------------- FIELD ---------------------->  
               
         <div class="form-group mb-2 show-if-select" id="extrafieldvalues" style="display: <?php echo $style; ?>;">
                
                    
            <input type="hidden" name="asw_cs_values[]" value="" />
           
           
           </div>
                
               <!-------------------- FIELD ---------------------->  
             
              <!-------------------- FIELD ---------------------->
            <div class="form-group mb-2">
                <label class="txt500">
               Data Stored As
                </label>
                <div class="">
                  
                     <select name="asw_operator[]" class="form-control">
                        <option value="CHAR"<?php selected( $operator, 'CHAR' ); ?>>Text</option>
                        <option value="NUMERIC"<?php selected( $operator, 'NUMERIC' ); ?>>Numeric</option>
                        <option value="BINARY"<?php selected( $operator, 'BINARY' ); ?>>Binary</option>
                        <option value="DATE"<?php selected( $operator, 'DATE' ); ?>>Date</option>
                        <option value="DATETIME"<?php selected( $operator, 'DATETIME' ); ?>>Datetime</option>
                        <option value="DECIMAL"<?php selected( $operator, 'DECIMAL' ); ?>>Decimal</option>
                        <option value="SIGNED"<?php selected( $operator, 'SIGNED' ); ?>>Signed</option>
                        <option value="TIME"<?php selected( $operator, 'TIME' ); ?>>TIME</option>
                        <option value="UNSIGNED"<?php selected( $operator, 'UNSIGNED' ); ?>>Unsigned</option>
                         
                    </select>
                     
                </div>
            </div>
            <!-------------------- FIELD ---------------------->  
                 
                
               <!-------------------- FIELD ---------------------->
            <div class="form-group mb-2">
                <label class="txt500">
              Returned Values Must
                </label>
                <div class="">
                  
                  <select name="asw_compare[]" class="form-control">
                        <option value="="<?php selected( $compare, '=' ); ?>>Equal Search Query</option>
                        <option value="!="<?php selected( $compare, '!=' ); ?>>Not Equal Search Query</option>
                        <option value=">"<?php selected( $compare, '>' ); ?>>Greater Than Search Query</option>
                        <option value=">="<?php selected( $compare, '>=' ); ?>>Greater than or eaual Search Query</option>
                        <option value="<"<?php selected( $compare, '<' ); ?>>Less than Search Query</option>
                        <option value="<="<?php selected( $compare, '<=' ); ?>>Less than or eaual Search Query</option>
                        <option value="LIKE"<?php selected( $compare, 'LIKE' ); ?>>(Like) Search Query</option>
                        <option value="IN"<?php selected( $compare, 'IN' ); ?>>(In) Search Query</option>
                        <option value="NOT IN"<?php selected( $compare, 'NOT IN' ); ?>>(Not In) Search Query</option>
                        <!-- <option value="BETWEEN"<?php selected( $compare, 'BETWEEN' ); ?>>Between</option> -->
                        
                        <!-- <option value="NOT BETWEEN"<?php selected( $compare, 'NOT BETWEEN' ); ?>>Not Between</option> -->
                    </select>
                 
                </div>
            </div>
           
            <input type="hidden" name="asw_key_alias[]" value="no" />             
           
                 
            </div>
        </li>
         
       
        <?php
    }
	
	
	function head_field( $data = null ){
	
	global  $CORE;
	
	  $label = '';
	  $alias = '';
	   if ( !is_null( $data ) ) {
            $label = stripslashes($data->label);
            $alias = $alias = $data->alias;
        }
		
		// DECODE JASON TITLE
		$titles = json_decode($label, true);
	
	?>
    
 
        <li class="cfielditem adsearchbox closed"><div class="heading">
        
        <div class="showhide">
        
        	<a href="javascript:void(0);" rel="tooltip" data-original-title="Delete" data-placement="top" class="asw-remove-el btn btn-primary btn-sm"><i class="fas fa-times" aria-hidden="true"></i></a>
       
            <a href="#" onclick="jQuery('.ssf-<?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>').fadeToggle();" rel="tooltip" data-original-title="Show/Hide Options" data-placement="top" class="btn btn-primary btn-sm">
            <i class="fa fa-search" aria-hidden="true"></i>
            </a> 
                                         
        </div> 
            
            <div class="name">
            
            
            <span class="badge -">Custom Field</span><span>
                    <?php
                    if ( isset($titles['en_us']) ) {
                        echo ' - ' . stripslashes($titles['en_us']);
                    }
                    ?></span>
            </div>
            
            </div>
            <div class="inside clearfix ssf-<?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>">
            
              <input type="hidden" name="csw_field_type[]" value="head" /> 
              <input type="hidden" name="asw_operator[]" value="" />
              <input type="hidden" name="asw_cs_values[]" value="" />
              <input type="hidden" name="asw_cs_type[]" value="" />
              <input type="hidden" name="asw_compare[]" value="" />
              <input type="hidden" name="asw_key[]" value="" />
              <input type="hidden" name="asw_help[]" value="" />
              
              <input type="hidden" name="asw_link[]" value="" />
                    
                    
            <!-------------------- FIELD ---------------------->
            <div class="form-group mb-2">
                <label class="txt500">
                Display Caption
                </label>
                <div class="">
                  
                  <input type="text" class="form-control form-control-smrequired" name="asw_label_en_us[]" id="head_asw_label_en_us<?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>" value="<?php echo esc_attr( stripslashes($titles['en_us']) ); ?>" />
                  
                    
                    
<?php if(is_array(_ppt('languages') )){ foreach(_ppt('languages') as $lang){ $icon = explode("_",$lang); if(strtolower($icon[1]) == "us"){ continue; } ?>
<div class="input-group"> 
<span class="add-on input-group-prepend"> 


<a href="javascript:void(0);" onclick="ajax_translate(jQuery('#head_asw_label_en_us<?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>').val(),'en','<?php echo strtolower($lang); ?>','#custom_asw_label_<?php echo strtolower($lang); ?><?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>');">
<div class="flag flag-<?php if(isset($icon[1])){ echo strtolower($icon[1]); }else{ echo $icon[0]; } ?>">&nbsp;</div>
</a>

</span>     
<input type="input" name="asw_label_<?php echo strtolower($lang); ?>[]" id="custom_asw_label_<?php echo strtolower($lang); ?><?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>" class="form-control form-control-smrequired" value="<?php echo esc_attr( stripslashes($titles[strtolower($lang)]) ); ?>">
</div>    
<?php } } ?>    
                     
                </div>
            </div>
          <input type="hidden" name="asw_key_alias[]" value="no" />
          
            
            
    </li>   
    
    
    <?php 	
	
	}

    /**
     * Builds an taxonomy field area for search form builder
     *
     * @param null|object $data
     */
    function taxonomy_field( $data = null ) {
	
	global  $CORE;
	
        $label = '';
        $taxonomy = '';
        $compare = '';
        $help = '';
        $field_type = 'no';
		$alias = '';
		$link_field = "";

        if ( !is_null( $data ) ) {
            $label = $data->label;
            $taxonomy = $data->key;
			$link_field = $data->link;
            $compare = $data->compare;
            $help = $data->description;
            $field_type = $data->field_type;
			$alias = $data->alias;
        }
		
		// DECODE JASON TITLE
		$titles = json_decode($label, true);

        $taxs = get_taxonomies();
        $exclude = array('nav_menu', 'link_category', 'post_format','post_tag');
        foreach ($exclude as $ex) {
            if ( in_array( $ex, $taxs ) ) {
                unset( $taxs[$ex] );
            }
        }
        ?>
        <li class="cfielditem adsearchbox closed"><div class="heading">
        
        <div class="showhide">
        
        	<a href="javascript:void(0);" rel="tooltip" data-original-title="Delete" data-placement="top" class="asw-remove-el btn btn-primary btn-sm"><i class="fas fa-times" aria-hidden="true"></i></a>
       
            <a href="#" onclick="jQuery('.ssf-<?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>').fadeToggle();" rel="tooltip" data-original-title="Show/Hide Options" data-placement="top" class="btn btn-primary btn-sm">
            <i class="fa fa-search" aria-hidden="true"></i>
            </a> 
                                         
        </div> 
            
            <div class="name">
            
            
            <span class="badge badge-default">Taxonomy</span><span>
                    <?php
                    if ( isset($titles['en_us']) ) {
                        echo ' - ' . stripslashes($titles['en_us']);
                    }
                    ?></span>
            </div>
            
            </div>
            <div class="inside clearfix ssf-<?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>">
            
              <input type="hidden" name="csw_field_type[]" value="taxonomy" /> 
                    <input type="hidden" name="asw_operator[]" value="" />
                    <input type="hidden" name="asw_cs_values[]" value="" />
                     
            <!-------------------- FIELD ---------------------->
            <div class="form-group mb-2">
                <label class="txt500">
                Display Caption
                </label>
                <div class="">
                  
                  <input type="text" class="form-control form-control-smrequired"  name="asw_label_en_us[]" id="tax_asw_label_en_us<?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>" value="<?php echo esc_attr( stripslashes($titles['en_us']) ); ?>" />
                  
                    
                    
<?php if(is_array(_ppt('languages') )){   foreach(_ppt('languages') as $lang){ $icon = explode("_",$lang); if(strtolower($icon[1]) == "us"){ continue; } ?>
<div class="input-group"> 
<span class="add-on input-group-prepend"> 

<a href="javascript:void(0);" onclick="ajax_translate(jQuery('#tax_asw_label_en_us<?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>').val(),'en','<?php echo strtolower($lang); ?>','#tax_asw_label_<?php echo strtolower($lang); ?><?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>');">
<div class="flag flag-<?php if(isset($icon[1])){ echo strtolower($icon[1]); }else{ echo $icon[0]; } ?>">&nbsp;</div>
</a>

</span>     
<input type="input" name="asw_label_<?php echo strtolower($lang); ?>[]" id="tax_asw_label_<?php echo strtolower($lang); ?><?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>" class="form-control form-control-smrequired" value="<?php if(isset($titles[strtolower($lang)])){ echo esc_attr( stripslashes($titles[strtolower($lang)]) ); } ?>">
</div>    
<?php } } ?>    
                     
                </div>
            </div>
            <!-------------------- FIELD ---------------------->
            
             <input type="hidden" name="asw_help[]" value="" />
            
            <!-------------------- FIELD ---------------------->
            <div class="form-group mb-2">
                <label class="txt500">
               Taxonomy
                </label>
                <div class="">
                  
                 <select name="asw_key[]" class="form-control">
                        <?php
						$not_wanted = array('nav_menu','post_tag','post_format');									
                        foreach ($taxs as $tax) {
							if(in_array($tax,$not_wanted)){ continue; }
							if($tax == "category"){ $display_text = "Blog Category"; }elseif($tax == "listing"){ $display_text = "Listing Categories"; }else{ $display_text = $tax; }
							
                            printf( '<option value="%1$s"%2$s>%3$s</option>', $tax, selected( $taxonomy, $tax, false ), $display_text );
                        }
                        ?>
                    </select>
                </div>
            </div>
            <!-------------------- FIELD ---------------------->

            <!-------------------- FIELD ---------------------->
            <div class="form-group mb-2">
                <label class="txt500">
               Display Type
                </label>
                <div class="">
                  
                 <select name="asw_cs_type[]" class="form-control">
                        <option value="no"<?php selected( $field_type, '' ); ?>>Listbox</option>
                        <option value="yes"<?php selected( $field_type, 'multi' ); ?>>Multi Select Listbox</option>
                        <option value="link"<?php selected( $field_type, 'link' ); ?>>List of Checkboxes</option>
                    </select>
                </div>
            </div>
            <!-------------------- FIELD ---------------------->
            
            <!-------------------- FIELD ---------------------->
            <div class="form-group mb-2">
                <label class="txt500">
               Linked Taxonomy
                </label>
                <div class="">
                  
                  <select class="form-control" name="asw_link[]">
                    <option value="">This field is not linked.</option>
                    <option value="disabled" <?php if($link_field == "disabled"){ echo "selected=selected"; } ?>>This field is already linked. (disable me)</option>
                    <?php
                        foreach ($taxs as $tax) {
							
							if($tax == "category"){ $display_text = "Blog Category"; }elseif($tax == "listing"){ $display_text = "Listing Categories"; }else{ $display_text = $tax; }
							
                            printf( '<option value="%1$s"%2$s>%3$s</option>', $tax, selected( $link_field, $tax, false ), $display_text );
                        }
                        ?>
                    </select>
                    
                    <span class="text-muted mt-2 small">If the result selected within this field will populate another, select the linked field above.</span>
                    
                </div>
            </div>            
   
                   
                            
          <!-------------------- FIELD ---------------------->
            <div class="form-group mb-2">
                <label class="txt500">
               Compare
                </label>
                <div class="">
                  
               
                    <select name="asw_compare[]" class="form-control">
                        <option value="IN"<?php selected( $compare, 'IN' ); ?>>In</option>
                        <option value="NOT IN"<?php selected( $compare, 'NOT IN' ); ?>>Not In</option>
                        <option value="AND"<?php selected( $compare, 'AND' ); ?>>And</option>
                    </select>
                    <span class="text-muted mt-2 small">how to compare the input value with the taxonomy? Default is <b>IN</b></span>
                </div>
            </div>
            <!-------------------- FIELD ---------------------->                
               
                
                
             <input type="hidden" name="asw_key_alias[]" value="no" />

               
            </div>
        </li>
        <?php
    }

    /**
     * Builds an search field area for search form builder
     *
     * @param null|object $data
     */
    function search_field( $data = null ) {
        $label = '';

        if ( !is_null( $data ) ) {
            $label = $data->label;
			$alias = $data->alias;
        }
		
		// DECODE JASON TITLE
		$titles = json_decode($label, true);
		 
        ?>
        
        
        <li class="cfielditem adsearchbox closed" style="display:none;"><div class="heading">
        
        <div class="showhide">
        
        	<a href="javascript:void(0);" rel="tooltip" data-original-title="Delete" data-placement="top" class="asw-remove-el btn btn-primary btn-sm"><i class="fas fa-times" aria-hidden="true"></i></a>
       
            <a href="#" onclick="jQuery('.ssf-<?php if(isset($data->id)){ echo $data->id; } ?>').fadeToggle();" rel="tooltip" data-original-title="Show/Hide Options" data-placement="top" class="btn btn-primary btn-sm">
            <i class="fa fa-search" aria-hidden="true"></i>
            </a> 
                                         
        </div> 
            
            <div class="name">
            
             
            <span class="badge badge-info">Keyword Search</span><span>
                    <?php
                    if ( isset($titles['en_us']) ) {
                        echo ' - ' . stripslashes($titles['en_us']);
                    }
                    ?></span>
            </div>
            
            </div>
            <div class="inside clearfix ssf-<?php if(isset($data->id)){ echo $data->id; }  ?>">
                <p>
                    <label>Label</label>
                      <input type="text" class="form-control form-control-smrequired" 
                       name="asw_label_en_us[]" id="search_asw_label_en_us<?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>" value="<?php echo esc_attr( stripslashes($titles['en_us']) ); ?>" />
                  
                    
                    
<?php if(is_array(_ppt('languages') )){   foreach(_ppt('languages') as $lang){ $icon = explode("_",$lang); if(strtolower($icon[1]) == "us"){ continue; } ?>
<div class="input-group"> 
<span class="add-on input-group-prepend"> 

<a href="javascript:void(0);" onclick="ajax_translate(jQuery('#search_asw_label_en_us<?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>').val(),'en','<?php echo strtolower($lang); ?>','#search_asw_label_<?php echo strtolower($lang); ?><?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>');">
<div class="flag flag-<?php if(isset($icon[1])){ echo strtolower($icon[1]); }else{ echo $icon[0]; } ?>">&nbsp;</div>
</a>

</span>     
<input type="input" name="asw_label_<?php echo strtolower($lang); ?>[]" id="search_asw_label_<?php echo strtolower($lang); ?><?php if(isset($data) && !empty($data) ){ echo $data->id; } ?>" class="form-control form-control-smrequired" value="<?php if(isset($titles[strtolower($lang)])){ echo esc_attr( stripslashes($titles[strtolower($lang)]) ); } ?>">
</div>    
<?php } } ?>    

                    <input type="hidden" name="csw_field_type[]" value="search" />
                    <input type="hidden" name="asw_operator[]" value="" />
                    <input type="hidden" name="asw_cs_values[]" value="" />
                    <input type="hidden" name="asw_cs_type[]" value="" />
                    <input type="hidden" name="asw_compare[]" value="" />
                    <input type="hidden" name="asw_key[]" value="" />
                    <input type="hidden" name="asw_help[]" value="" />
                   
                    <input type="hidden" name="asw_link[]" value="" />
                </p>
                
                
                <input type="hidden" name="asw_key_alias[]" value="no" />

             
            </div>
            
            
        </li>
<?php
} 

    /**
     * Builds the drag-n-drop field area for admin form builder
     *
     * @global object $wpdb
     * @param null|object $fields
     * @return string
     */
    function build_builder_form( $fields = null ) {
        global $wpdb;

        if ( is_null( $fields ) ) {
            $fields = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}core_search ORDER BY `order` ASC" );
        }

        ob_start();
        foreach ($fields as $field) {

            switch ($field->type) {
                case 'custom':
                    $this->custom_field( $field );
                    break;

                case 'taxonomy':
                    $this->taxonomy_field( $field );
                    break;

                case 'search':
                    $this->search_field( $field );
                    break;
					
				case 'head':
                    $this->head_field( $field );
                    break;

                default:
                    break;
            }
        }

        return ob_get_clean();
    } 

}

$advance_search = core_search::instance();

/**
 * Create HTML dropdown list of Categories.
 *
 * It's a customized walker. Used only on custom taxonomies printing slug
 * instead of term_id
 *
 * @uses Walker
 */
class ASW_Category_Dropdown extends Walker_CategoryDropdown {

    function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
        $pad = str_repeat( '&nbsp;', $depth * 3 );

        //var_dump($category);
        $cat_name = apply_filters( 'list_cats', $category->name, $category );
        $output .= "\t<option class=\"level-$depth\" id=\"{$category->taxonomy}-{$category->term_id}\" value=\"" . $category->slug . "\"";
        if ( $category->slug == $args['selected'] )
            $output .= ' selected="selected"';
        $output .= '>';
        $output .= $pad . $cat_name;
        if ( $args['show_count'] )
            $output .= '&nbsp;&nbsp;(' . $category->count . ')';
        $output .= "</option>\n";
    }

}  