var arrCounties = new Array() arrCounties['AE'] = "|||$Abu Dhabi|||$Ajman|||$Al Fujayrah|||$Dubai|||$Ra's al Khaymah|||$Sharjah|||$Umm al Qaywayn|||"; arrCounties['AR'] = "|||$Chaco|||$Chubut|||$Ciudad de Buenos Aires|||$Córdoba|||$Corrientes|||$Entre Ríos|||$Formosa|||$Jujuy|||$La Pampa|||$La Rioja|||$Mendoza|||$Misiones|||$Neuquén|||$Provincia de Buenos Aires|||$Río Negrob|||$Salta|||$San Juan|||$San Luis|||$Santa Cruz|||$Santa Fe|||$Santiago del Estero|||$Tierra del Fuego|||$Tucumán|||"; arrCounties['AU'] = "|||ACT$ACT|||NSW$New South Wales|||NT$Northern Territory|||QLD$Queensland|||SAC$South Australia|||TAS$Tasmania|||VIC$Victoria|||WA$Western Australia|||"; arrCounties['BR'] = "|||$AC - Acre|||$AL - Alagoas|||$AM - Amazonas|||$AP - Amapá|||$BA - Bahia|||$CE - Ceará|||$DF - Distrito Federal|||$ES - Espírito Santo|||$GO - Goiás|||$MA - Maranhão|||$MG - Minas Gerais|||$MS - Mato Grosso do Sul|||$MT - Mato Grosso|||$PA - Pará|||$PB - Paraíba|||$PE - Pernambuco|||$PI - Piauí|||$PR - Paraná|||$RJ - Rio de Janeiro|||$RN - Rio Grande do Norte|||$RO - Rondônia|||$RR - Roraima|||$RS - Rio Grande do Sul|||$SC - Santa Catarina|||$SE - Sergipe|||$SP - São Paulo|||$TO - Tocantins|||"; arrCounties['CA'] = "|||AB$Alberta|||BC$British Columbia|||MB$Manitoba|||NB$New Brunswick|||NL$Newfoundland and Labrador|||NT$Northwest Territories|||NS$Nova Scotia|||NU$Nunavut|||ON$Ontario|||PE$Prince Edward Island|||QC$Quebec|||SK$Saskatchewan|||YT$Yukon Territory|||"; arrCounties['CN'] = "|||$Anhui Province|||$Beijing Municipality|||$Chongqing Municipality|||$Fujian Province|||$Gansu Province|||$Guangdong Province|||$Guangxi Province|||$Guizhou Province|||$Hainan Province|||$Hebei Province|||$Heilongjiang Province|||$Henan Province|||$Hubei Province|||$Hunan Province|||$Inner Mongolia|||$Jiangsu Province|||$Jiangxi Province|||$Jilin Province|||$Liaoning Province|||$Ningxia Province|||$Qinghai Province|||$Shaanxi Province|||$Shandong Province|||$Shanghai Municipality|||$Shanxi Municipality|||$Sichuan Province|||$Tianjin Municipality|||$Tibet Autonomous Region|||$Xinjiang Province|||$Xinjiang Province|||$Yunnan Province|||$Zhejiang Province|||"; arrCounties['ES'] = "|||$A Coruña|||$Álava|||$Albacete|||$Alicante|||$Almería|||$Asturias|||$Ávila|||$Badajoz|||$Barcelona|||$Burgos|||$Cáceres|||$Cádiz|||$Castellón|||$Ceuta|||$Ciudad Real|||$Córdoba|||$Cuenca|||$Girona|||$Granada|||$Guadalajara|||$Guipúzcoa|||$Huelva|||$Huesca|||$Islas Baleares|||$Jaén|||$Las Palmas|||$León|||$Lleida|||$Logroño|||$Lugo|||$Madrid|||$Málaga|||$Melilla|||$Murcia|||$Navarra|||$Ourense|||$Palencia|||$Pontevedra|||$Salamanca|||$Santander|||$Segovia|||$Sevilla|||$Soria|||$Tarragona|||$Tenerife|||$Teruel|||$Toledo|||$Valencia|||$Valladolid|||$Vizcaya|||$Zamora|||$Zaragoza|||"; arrCounties['GB'] = "|||$Aberdeenshire|||$Angus|||$Argyll|||$Ayrshire|||$Banffshire|||$Bedfordshire|||$Berkshire|||$Berwickshire|||$Buckinghamshire|||$Caithness|||$Cambridgeshire|||$Cheshire|||$Clackmannanshire|||$Cleveland|||$Clwyd|||$Clwyn|||$Cornwall|||$County Antrim|||$County Armagh|||$County Down|||$County Durham|||$County Fermanagh|||$County Londonderry|||$County Tyrone|||$Cumbria|||$Derbyshire|||$Devon|||$Dorset|||$Dumfriesshire|||$Dunbartonshire|||$Dyfed|||$East Lothian|||$East Sussex|||$Essex|||$Fife|||$Gloucestershire|||$Gwent|||$Gwynedd|||$Hampshire|||$Herefordshire|||$Hertfordshire|||$Inverness-Shire|||$Isle of Arran|||$Isle of Barra|||$Isle of Bute|||$Isle of Cumbrae|||$Isle of Harris|||$Isle of Islay|||$Isle of Jura|||$Isle of Lewis|||$Isle of North Uist|||$Isle of Skye|||$Isle of South Uist|||$Isle of Tiree|||$Isle of Wight|||$Isles of Scilly|||$Kent|||$Kincardineshire|||$Kirkcudbrightshire|||$Lanarkshire|||$Lancashire|||$Leicestershire|||$Lincolnshire|||$Merseyside|||$Mid Glamorgan|||$Middlesex|||$Midlothian|||$Morayshire|||$Norfolk|||$North Humberside|||$North Yorkshire|||$Northamptonshire|||$Northumberland|||$Nottinghamshire|||$Orkney|||$Oxfordshire|||$Peeblesshire|||$Perthshire|||$Powys|||$Renfrewshire|||$Ross-Shire|||$Roxburghshire|||$Selkirkshire|||$Shetland Islands|||$Shropshire|||$Somerset|||$South Glamorgan|||$South Humberside|||$South Yorkshire|||$Staffordshire|||$Stirlingshire|||$Suffolk|||$Surrey|||$Tyne and Wear|||$Warwickshire|||$West Glamorgan|||$West Lothian|||$West Midlands|||$West Sussex|||$West Yorkshire|||$Wigtownshire|||$Wiltshire|||$Worcestershire|||$Yorkshire|||"; arrCounties['IE'] = "|||$Carlow|||$Cavan|||$Clare|||$Cork|||$Donegal|||$Dublin|||$Galway|||$Kerry|||$Kildare|||$Kilkenny|||$Laois|||$Leitrim|||$Limerick|||$Longford|||$Louth|||$Mayo|||$Meath|||$Monaghan|||$Offaly|||$Roscommon|||$Sligo|||$Tipperary|||$Waterford|||$Westmeath|||$Wexford|||$Wicklow|||"; arrCounties['IN'] = "|||IAN$Andaman & Nicobar Islands|||IAP$Andhra Pradesh|||IAR$Arunachal Pradesh|||IAS$Assam|||IBR$Bihar|||ICH$Chandigarh|||ICT$Chhattisgarh|||IDN$Dadra and Nagar Haveli|||IDD$Daman and Diu|||IDL$Delhi|||IGA$Goa|||IGJ$Gujarat|||IHR$Haryana|||IHP$Himachal Pradesh|||IJK$Jammu and Kashmir|||IJH$Jharkhand|||IKA$Karnataka|||IKL$Kerala|||ILD$Lakshadweep|||IMP$Madhya Pradesh|||IMH$Maharashtra|||IMN$Manipur|||IML$Meghalaya|||IMZ$Mizoram|||INL$Nagaland|||IOR$Odisha|||IPY$Puducherry|||IPB$Punjab|||IRJ$Rajasthan|||ISK$Sikkim|||ITN$Tamil Nadu|||ITG$Telangana|||ITR$Tripura|||IUP$Uttar Pradesh|||IUT$Uttarakhand|||IWB$West Bengal|||"; arrCounties['IT'] = "|||AG$Agrigento|||AL$Alessandria|||AN$Ancona|||AO$Aosta|||AR$Arezzo|||AP$Ascoli Piceno|||AT$Asti|||AV$Avellino|||BA$Bari|||BI$Barletta-Andria-Trani|||BT$Barletta-Andria-Trani|||BL$Belluno|||BN$Benevento|||BG$Bergamo|||BO$Bologna|||BZ$Bolzano|||BS$Brescia|||BR$Brindisi|||CA$Cagliari|||CL$Caltanissetta|||CB$Campobasso|||CI$Carbonia-Iglesias|||CE$Caserta|||CT$Catania|||CZ$Catanzaro|||CH$Chieti|||CO$Como|||ME$Cosenza|||CR$Cremona|||KR$Crotone|||CN$Cuneo|||EN$Enna|||FM$Fermo|||FE$Ferrara|||FI$Firenze|||FG$Foggia|||FC$Forlì-Cesena|||FR$Frosinone|||GE$Genova|||GO$Gorizia|||GR$Grosseto|||IM$Imperia|||IS$Isernia|||SP$La Spezia|||AQ$L'Aquila|||LT$Latina|||LE$Lecce|||LC$Lecco|||LI$Livorno|||LO$Lodi|||LU$Lucca|||MC$Macerata|||MN$Mantova|||MS$Massa-Carrara|||MT$Matera|||VS$Medio Campidano|||ME$Messina|||MI$Milano|||MO$Modena|||MB$Monza e della Brianza|||NA$Napoli|||NO$Novara|||NU$Nuoro|||OG$Ogliastra|||OT$Olbia-Tempio|||OR$Oristano|||PD$Padova|||PA$Palermo|||PR$Parma|||PV$Pavia|||PG$Perugia|||PU$Pesaro e Urbino|||PE$Pescara|||PC$Piacenza|||PI$Pisa|||PT$Pistoia|||PN$Pordenone|||PZ$Potenza|||PO$Prato|||RG$Ragusa|||RA$Ravenna|||RC$Reggio Calabria|||RE$Reggio Emilia|||RI$Rieti|||RN$Rimini|||RM$Roma|||RO$Rovigo|||SA$Salerno|||SS$Sassari|||SV$Savona|||SI$Siena|||SR$Siracusa|||SO$Sondrio|||TA$Taranto|||TE$Teramo|||TR$Terni|||TO$Torino|||TP$Trapani|||TN$Trento|||TV$Treviso|||TS$Trieste|||UD$Udine|||VA$Varese|||VE$Venezia|||VB$Verbano-Cusio-Ossola|||VC$Vercelli|||VR$Verona|||VV$Vibo Valentia|||VI$Vicenza|||VT$Viterbo|||"; arrCounties['MX'] = "|||$Aguascalientes|||$Baja California|||$Baja California Sur|||$Campeche|||$Chiapas|||$Chihuahua|||$Coahuila|||$Colima|||$Distrito Federal|||$Durango|||$Guanajuato|||$Guerrero|||$Hidalgo|||$Jalisco|||$México|||$Michoacán|||$Morelos|||$Nayarit|||$Nuevo León|||$Oaxaca|||$Puebla|||$Querétaro|||$Quintana Roo|||$San Luis Potosí|||$Sinaloa|||$Sonora|||$Tabasco|||$Tamaulipas|||$Tlaxcala|||$Veracruz|||$Yucatán|||$Zacatecas|||"; arrCounties['NO'] = "|||$Akershus|||$Aust-Agder|||$Buskerud|||$Finnmark|||$Hedmark|||$Hordaland|||$Møre og Romsdal|||$Nordland|||$Nord-Trøndelag|||$Oppland|||$Oslo|||$Østfold|||$Rogaland|||$Sogn og Fjordane|||$Sør-Trøndelag|||$Telemark|||$Troms|||$Vest-Agder|||$Vestfold|||"; arrCounties['NZ'] = "|||$Auckland|||$Bay of Plenty|||$Canterbury|||$Gisborne|||$Hawke’s Bay|||$Manawatu-Whanganui|||$Marlborough|||$Nelson|||$Northland|||$Otago|||$Southland|||$Taranaki|||$Tasman|||$Waikato|||$Wellington|||$West Coast|||"; arrCounties['US'] = "|||AA$AA - Military|||AD$AD - Military|||AE$AE - Military|||AL$Alabama|||AK$Alaska|||AP$AP - Military|||AZ$Arizona|||AR$Arkansas|||CA$California|||CO$Colorado|||CT$Connecticut|||DE$Delaware|||DC$District of Columbia|||FL$Florida|||GA$Georgia|||HI$Hawaii|||ID$Idaho|||IL$Illinois|||IN$Indiana|||IA$Iowa|||KS$Kansas|||KY$Kentucky|||LA$Louisiana|||ME$Maine|||MD$Maryland|||MA$Massachusetts|||MI$Michigan|||MN$Minnesota|||MS$Mississippi|||MO$Missouri|||MT$Montana|||NE$Nebraska|||NV$Nevada|||NH$New Hampshire|||NJ$New Jersey|||NM$New Mexico|||NY$New York|||NC$North Carolina|||ND$North Dakota|||OH$Ohio|||OK$Oklahoma|||OR$Oregon|||PA$Pennsylvania|||RI$Rhode Island|||SC$South Carolina|||SD$South Dakota|||TN$Tennessee|||TX$Texas|||UT$Utah|||VT$Vermont|||VA$Virginia|||WA$Washington|||WV$West Virginia|||WI$Wisconsin|||WY$Wyoming|||"; arrCounties['ZA'] = "|||$Eastern Cape|||$Free State|||$Gauteng|||$Kwazulu-Natal|||$Limpopo|||$Mpumalanga|||$North West|||$Northern Cape|||$Western Cape|||"; var county_countries = '|AE|AR|AU|BR|CA|CN|ES|GB|IE|IN|IT|MX|NO|NZ|US|ZA|'; var arrCountries = new Array() arrCountries[4] = "AF"; arrCountries[5] = "AL"; arrCountries[6] = "DZ"; arrCountries[7] = "AS"; arrCountries[8] = "AD"; arrCountries[9] = "AO"; arrCountries[10] = "AI"; arrCountries[11] = "AQ"; arrCountries[12] = "AG"; arrCountries[13] = "AR"; arrCountries[14] = "AM"; arrCountries[15] = "AW"; arrCountries[253] = "AA"; arrCountries[16] = "AU"; arrCountries[17] = "AT"; arrCountries[18] = "AZ"; arrCountries[19] = "BS"; arrCountries[20] = "BH"; arrCountries[21] = "BD"; arrCountries[22] = "BB"; arrCountries[23] = "BY"; arrCountries[24] = "BE"; arrCountries[25] = "BZ"; arrCountries[26] = "BJ"; arrCountries[27] = "BM"; arrCountries[28] = "BT"; arrCountries[29] = "BO"; arrCountries[30] = "BA"; arrCountries[31] = "BW"; arrCountries[32] = "BV"; arrCountries[33] = "BR"; arrCountries[34] = "IO"; arrCountries[35] = "BN"; arrCountries[36] = "BG"; arrCountries[37] = "BF"; arrCountries[38] = "BI"; arrCountries[39] = "KH"; arrCountries[40] = "CM"; arrCountries[41] = "CA"; arrCountries[243] = "IC"; arrCountries[42] = "CV"; arrCountries[43] = "KY"; arrCountries[44] = "CF"; arrCountries[45] = "TD"; arrCountries[252] = "CB"; arrCountries[46] = "CL"; arrCountries[47] = "CN"; arrCountries[251] = "CX"; arrCountries[249] = "CC"; arrCountries[48] = "CO"; arrCountries[49] = "KM"; arrCountries[235] = "CD"; arrCountries[51] = "CK"; arrCountries[52] = "CR"; arrCountries[54] = "HR"; arrCountries[55] = "CU"; arrCountries[56] = "CY"; arrCountries[57] = "CZ"; arrCountries[58] = "DK"; arrCountries[59] = "DJ"; arrCountries[60] = "DM"; arrCountries[61] = "DO"; arrCountries[62] = "TL"; arrCountries[63] = "EC"; arrCountries[64] = "EG"; arrCountries[65] = "SV"; arrCountries[66] = "GQ"; arrCountries[67] = "ER"; arrCountries[68] = "EE"; arrCountries[69] = "ET"; arrCountries[70] = "FK"; arrCountries[71] = "FO"; arrCountries[139] = "FM"; arrCountries[72] = "FJ"; arrCountries[73] = "FI"; arrCountries[74] = "FR"; arrCountries[76] = "GF"; arrCountries[77] = "PF"; arrCountries[78] = "TF"; arrCountries[80] = "GA"; arrCountries[81] = "GM"; arrCountries[82] = "GE"; arrCountries[83] = "DE"; arrCountries[84] = "GH"; arrCountries[85] = "GI"; arrCountries[86] = "GR"; arrCountries[87] = "GL"; arrCountries[88] = "GD"; arrCountries[89] = "GP"; arrCountries[90] = "GU"; arrCountries[91] = "GT"; arrCountries[999188] = "GG"; arrCountries[92] = "GN"; arrCountries[93] = "GW"; arrCountries[94] = "GY"; arrCountries[95] = "HT"; arrCountries[96] = "HM"; arrCountries[226] = "VA"; arrCountries[97] = "HN"; arrCountries[98] = "HK"; arrCountries[99] = "HU"; arrCountries[100] = "IS"; arrCountries[101] = "IN"; arrCountries[102] = "ID"; arrCountries[103] = "IR"; arrCountries[104] = "IQ"; arrCountries[105] = "IE"; arrCountries[250] = "IM"; arrCountries[238] = "IL"; arrCountries[106] = "IT"; arrCountries[53] = "CI"; arrCountries[107] = "JM"; arrCountries[108] = "JP"; arrCountries[214] = "JE"; arrCountries[109] = "JO"; arrCountries[110] = "KZ"; arrCountries[111] = "KE"; arrCountries[112] = "KI"; arrCountries[115] = "KW"; arrCountries[116] = "KG"; arrCountries[117] = "LA"; arrCountries[118] = "LV"; arrCountries[119] = "LB"; arrCountries[120] = "LS"; arrCountries[121] = "LR"; arrCountries[122] = "LY"; arrCountries[123] = "LI"; arrCountries[124] = "LT"; arrCountries[125] = "LU"; arrCountries[126] = "MO"; arrCountries[79] = "MK"; arrCountries[127] = "MG"; arrCountries[128] = "MW"; arrCountries[129] = "MY"; arrCountries[130] = "MV"; arrCountries[131] = "ML"; arrCountries[132] = "MT"; arrCountries[133] = "MH"; arrCountries[134] = "MQ"; arrCountries[135] = "MR"; arrCountries[136] = "MU"; arrCountries[137] = "YT"; arrCountries[138] = "MX"; arrCountries[140] = "MD"; arrCountries[141] = "MC"; arrCountries[142] = "MN"; arrCountries[246] = "ME"; arrCountries[143] = "MS"; arrCountries[144] = "MA"; arrCountries[145] = "MZ"; arrCountries[146] = "MM"; arrCountries[147] = "NA"; arrCountries[148] = "NR"; arrCountries[149] = "NP"; arrCountries[150] = "NL"; arrCountries[151] = "AN"; arrCountries[152] = "NC"; arrCountries[153] = "NZ"; arrCountries[154] = "NI"; arrCountries[155] = "NE"; arrCountries[156] = "NG"; arrCountries[157] = "NU"; arrCountries[158] = "NF"; arrCountries[113] = "KP"; arrCountries[159] = "MP"; arrCountries[160] = "NO"; arrCountries[161] = "OM"; arrCountries[162] = "PK"; arrCountries[163] = "PW"; arrCountries[164] = "PS"; arrCountries[165] = "PA"; arrCountries[166] = "PG"; arrCountries[167] = "PY"; arrCountries[168] = "PE"; arrCountries[169] = "PH"; arrCountries[170] = "PN"; arrCountries[171] = "PL"; arrCountries[172] = "PT"; arrCountries[173] = "PR"; arrCountries[174] = "QA"; arrCountries[175] = "RE"; arrCountries[176] = "RO"; arrCountries[177] = "RU"; arrCountries[178] = "RW"; arrCountries[244] = "MF"; arrCountries[184] = "WS"; arrCountries[185] = "SM"; arrCountries[186] = "ST"; arrCountries[187] = "SA"; arrCountries[188] = "SN"; arrCountries[245] = "RS"; arrCountries[189] = "SC"; arrCountries[190] = "SL"; arrCountries[191] = "SG"; arrCountries[192] = "SK"; arrCountries[193] = "SI"; arrCountries[194] = "SB"; arrCountries[195] = "SO"; arrCountries[196] = "ZA"; arrCountries[197] = "GS"; arrCountries[114] = "KR"; arrCountries[198] = "ES"; arrCountries[199] = "LK"; arrCountries[254] = "BL"; arrCountries[179] = "SH"; arrCountries[180] = "KN"; arrCountries[181] = "LC"; arrCountries[182] = "PM"; arrCountries[183] = "VC"; arrCountries[200] = "SD"; arrCountries[201] = "SR"; arrCountries[202] = "SJ"; arrCountries[203] = "SZ"; arrCountries[204] = "SE"; arrCountries[205] = "CH"; arrCountries[206] = "SY"; arrCountries[207] = "TW"; arrCountries[208] = "TJ"; arrCountries[209] = "TZ"; arrCountries[210] = "TH"; arrCountries[211] = "TG"; arrCountries[212] = "TK"; arrCountries[213] = "TO"; arrCountries[3] = "TT"; arrCountries[214] = "TN"; arrCountries[215] = "TR"; arrCountries[216] = "TM"; arrCountries[217] = "TC"; arrCountries[218] = "TV"; arrCountries[219] = "UG"; arrCountries[220] = "UA"; arrCountries[221] = "AE"; arrCountries[2] = "GB"; arrCountries[222] = "UM"; arrCountries[223] = "UY"; arrCountries[1] = "US"; arrCountries[224] = "UZ"; arrCountries[225] = "VU"; arrCountries[227] = "VE"; arrCountries[228] = "VN"; arrCountries[229] = "VG"; arrCountries[230] = "VI"; arrCountries[231] = "WF"; arrCountries[232] = "EH"; arrCountries[233] = "YE"; arrCountries[234] = "YU"; arrCountries[236] = "ZM"; arrCountries[237] = "ZW"; var counties_loaded = false; function LoadCounties(selForm, selElement, selPrimaryElement, textElement){ var primaryDelimiter = "|||"; var secondaryDelimiter = "|"; var codeDelimiter = "$"; var CountryWithProviceCode = "16,AU,41,CA,106,IT"; //Australia, Canada, Italy var IsCountryWithProvinceCode = false; var selectedCountry = ""; var parsingData; var strList = selElement; if(document.forms[selForm]) { selElement = document.forms[selForm].elements[selElement]; // Task ID -E-Comm Start textElement = document.forms[selForm].elements[textElement]; // Task ID -E-Comm End selElement.disabled = false; var primarySelectedIndex = document.forms[selForm].elements[selPrimaryElement].selectedIndex; //alert(primarySelectedIndex); var primaryValue = document.forms[selForm].elements[selPrimaryElement].options[primarySelectedIndex].value; //alert(primaryValue); if(primaryValue.indexOf("|") > -1){ var arrCountry = primaryValue.split(secondaryDelimiter); primaryValue = arrCountry[0]; } if(IsValueNumeric(primaryValue)){ selectedCountry = primaryValue; primaryValue = arrCountries[primaryValue]; } else { selectedCountry = primaryValue; } var arrCt = CountryWithProviceCode.split(','); if (jQuery.inArray(selectedCountry, arrCt) > -1) { IsCountryWithProvinceCode = true; } //alert(primaryValue); //alert(county_countries); if(county_countries.indexOf('|'+primaryValue+'|') > -1){ //alert("here"); parsingData = arrCounties[primaryValue]; jQuery(textElement).value = ""; jQuery(textElement).hide(); jQuery(selElement).show(); //jQuery(selElement).parents().find('.UKState').show(); counties_loaded = true; if (parsingData == null) return; var arr = parsingData.split(primaryDelimiter); var arr2; //alert(primaryValue); while (selElement.options.length > 0) selElement.remove(0); //2013.11.12 JEF Hack to force state province selection for all countries with the exception of //AE :United Arab Emirates, AU :Australia, ES :Spain, GB :UK, IE :Ireland //if ( primaryValue == "AE" || primaryValue == "AU" || primaryValue == "ES" || primaryValue == "GB" || primaryValue == "IE" ) { //All the countries with provience will mandatorily have "Please Select" now. var element = document.createElement("OPTION"); element.value = ""; if ( primaryValue == "IN" ) { element.text = "Select state"; } else { element.text = "Select province"; } selElement.options.add(element); //} for (var i = 0; i < arr.length; i++){ if(arr[i].length > 0){ var element = document.createElement("OPTION"); arr2 = arr[i].split(codeDelimiter); if ( IsCountryWithProvinceCode == true ) { if (arr2[0].length > 0){ element.value = arr2[0]; } else{ element.value = arr2[1]; } }else{ element.value = arr2[1]; } element.text = arr2[1]; selElement.options.add(element); } } //alert("Please select a State/Province"); //selElement.focus(); } else{ while (selElement.options.length > 0) selElement.remove(0); jQuery(textElement).show(); jQuery(selElement).hide(); jQuery(selElement).parent().parent().find('.ukprovice').hide(); counties_loaded = false; } } } function selectCounty(selectedcounty, countylist){ if(counties_loaded){ if(countylist.options.length > 0){ for(x = 0; x < countylist.options.length; x++){ if(countylist.options[x].value == selectedcounty){ countylist.options[x].selected = true; } } } } } function IsValueNumeric(sValue){ var ValidChars = "0123456789"; var IsNumber=true; for (i = 0; i < sValue.length; i++){ sCharacter = sValue.charAt(i); if (ValidChars.indexOf(sCharacter) == -1){ IsNumber = false; } } return IsNumber; } function selectState(sForm, sElement, sValue){ for(x = 0; x < document.forms[sForm].elements[sElement].options.length; x++){ if(document.forms[sForm].elements[sElement].options[x].value == sValue || document.forms[sForm].elements[sElement].options[x].text == sValue){ document.forms[sForm].elements[sElement].options[x].selected = true; } } }