/* This script and many more are available free online at The JavaScript Source :: http://javascript.internet.com Created by: Down Home Consulting :: http://downhomeconsulting.com */ /* Country State Drop Downs v1.0. (c) Copyright 2005 Down Home Consulting, Inc. www.DownHomeConsulting.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, itness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software. */ // If you have PHP you can set the post values like this //var postState = ''; //var postCountry = ''; var postState = 'US'; var postCountry = 'FL'; // State table // // To edit the list, just delete a line or add a line. Order is important. // The order displayed here is the order it appears on the drop down. // var stateList = '\ US:AL:Alabama|\ US:AK:Alaska|\ US:AZ:Arizona|\ US:AR:Arkansas|\ US:CA:California|\ US:CO:Colorado|\ US:CT:Connecticut|\ US:DE:Delaware|\ US:DC:District of Columbia|\ US:FL:Florida|\ US:GA:Georgia|\ US:HI:Hawaii|\ US:ID:Idaho|\ US:IL:Illinois|\ US:IN:Indiana|\ US:IA:Iowa|\ US:KS:Kansas|\ US:KY:Kentucky|\ US:LA:Louisiana|\ US:ME:Maine|\ US:MD:Maryland|\ US:MA:Massachusetts|\ US:MI:Michigan|\ US:MN:Minnesota|\ US:MS:Mississippi|\ US:MO:Missouri|\ US:MT:Montana|\ US:NE:Nebraska|\ US:NV:Nevada|\ US:NH:New Hampshire|\ US:NJ:New Jersey|\ US:NM:New Mexico|\ US:NY:New York|\ US:NC:North Carolina|\ US:ND:North Dakota|\ US:OH:Ohio|\ US:OK:Oklahoma|\ US:OR:Oregon|\ US:PA:Pennsylvania|\ US:PR:Puerto Rico|\ US:RI:Rhode Island|\ US:SC:South Carolina|\ US:SD:South Dakota|\ US:TN:Tennessee|\ US:TX:Texas|\ US:UT:Utah|\ US:VT:Vermont|\ US:VI:Virgin Islands|\ US:VA:Virginia|\ US:WA:Washington|\ US:WV:West Virginia|\ US:WI:Wisconsin|\ US:WY:Wyoming|\ AU:ACT:Australian Capital Territory|\ AU:TAS:Tasmania|\ AU:NT:Northern Territory|\ AU:WA:Western Australia|\ AU:SA:South Australia|\ AU:VIC:Victoria|\ AU:NSW:New South Wales|\ AU:QLD:Queensland|\ GB:Aberdeen:Aberdeen|\ GB:Aberdeenshire:Aberdeenshire|\ GB:Angus:Angus|\ GB:Ards:Ards|\ GB:ArgyllandBute:Argyll and Bute|\ GB:Armagh:Armagh|\ GB:Ballymena:Ballymena|\ GB:Ballymoney:Ballymoney|\ GB:Banbridge:Banbridge|\ GB:BarkingDagenham:Barking & Dagenham |\ GB:Barnet:Barnet |\ GB:Barnsley:Barnsley|\ GB:BathN.E.Somerset:Bath & N.E. Somerset|\ GB:Bedfordshire:Bedfordshire|\ GB:Belfast:Belfast|\ GB:Berkshire:Berkshire|\ GB:Bexley:Bexley |\ GB:Birmingham:Birmingham|\ GB:BlackburnwithDarwen:Blackburn with Darwen|\ GB:Blackpool:Blackpool|\ GB:BlaenauGwent:Blaenau Gwent|\ GB:Bournemouth:Bournemouth|\ GB:BracknellForest:Bracknell Forest|\ GB:Bradford:Bradford|\ GB:Brent:Brent |\ GB:Bridgend:Bridgend |\ GB:BrightonHove:Brighton & Hove|\ GB:Bristol:Bristol|\ GB:Bromley:Bromley |\ GB:Buckinghamshire:Buckinghamshire|\ GB:Caerphilly:Caerphilly |\ GB:Calderdale:Calderdale|\ GB:Cambridgeshire:Cambridgeshire|\ GB:Camden:Camden |\ GB:Cardiff:Cardiff |\ GB:Carmarthenshire:Carmarthenshire |\ GB:Carrickfergus:Carrickfergus|\ GB:Castlereagh:Castlereagh|\ GB:Ceredigion:Ceredigion |\ GB:Cheshire:Cheshire|\ GB:Clackmannanshire:Clackmannanshire|\ GB:Coleraine:Coleraine|\ GB:Conwy:Conwy|\ GB:Cookstown:Cookstown|\ GB:CornwallIslesofScilly:Cornwall & Isles of Scilly|\ GB:Coventry:Coventry|\ GB:Craigavon:Craigavon|\ GB:Croydon:Croydon |\ GB:Cumbria:Cumbria|\ GB:Darlington:Darlington|\ GB:Denbighshire:Denbighshire|\ GB:Derby:Derby |\ GB:Derbyshire:Derbyshire|\ GB:Derry:Derry|\ GB:Devon:Devon|\ GB:Doncaster:Doncaster|\ GB:Dorset:Dorset|\ GB:Down:Down|\ GB:Dudley:Dudley|\ GB:DumfriesGalloway:Dumfries & Galloway|\ GB:Dundee:Dundee|\ GB:Dungannon:Dungannon|\ GB:Durham:Durham|\ GB:Ealing:Ealing |\ GB:EastAyrshire:East Ayrshire|\ GB:EastDumbartonshire:East Dumbartonshire|\ GB:EastLothian:East Lothian|\ GB:EastRenfrewshire:East Renfrewshire|\ GB:EastRidingofYorkshire:East Riding of Yorkshire|\ GB:EastSussex:East Sussex|\ GB:Edinburgh:Edinburgh|\ GB:Enfield:Enfield |\ GB:Essex:Essex|\ GB:Falkirk:Falkirk|\ GB:Fermanagh:Fermanagh|\ GB:Fife:Fife|\ GB:Flintshire:Flintshire|\ GB:Gateshead:Gateshead|\ GB:Glasgow:Glasgow|\ GB:Gloucestershire:Gloucestershire|\ GB:GreaterManchester:Greater Manchester|\ GB:Greenwich:Greenwich |\ GB:Gwynedd:Gwynedd|\ GB:Hackney:Hackney |\ GB:Halton:Halton|\ GB:HammersmithFulham:Hammersmith & Fulham |\ GB:Hampshire:Hampshire|\ GB:Haringey:Haringey |\ GB:Harrow:Harrow |\ GB:Hartlepool:Hartlepool|\ GB:Havering:Havering |\ GB:Hertfordshire:Hertfordshire|\ GB:Highland:Highland|\ GB:Hillingdon:Hillingdon |\ GB:Hounslow:Hounslow |\ GB:Inverclyde:Inverclyde|\ GB:IsleofAnglesey:Isle of Anglesey|\ GB:IsleofWight:Isle of Wight|\ GB:Islington:Islington |\ GB:KensingtonChelsea:Kensington & Chelsea |\ GB:Kent:Kent|\ GB:KingstonuponHull:Kingston upon Hull|\ GB:KingstonUponThames:Kingston Upon Thames |\ GB:Kirklees:Kirklees|\ GB:Lambeth:Lambeth|\ GB:Lancashire:Lancashire |\ GB:Larne:Larne|\ GB:Leeds:Leeds|\ GB:Leicester:Leicester |\ GB:Leicestershire:Leicestershire|\ GB:Lewisham:Lewisham |\ GB:Limavady:Limavady|\ GB:Lincolnshire:Lincolnshire|\ GB:Lisburn:Lisburn|\ GB:Luton:Luton|\ GB:Magherafelt:Magherafelt|\ GB:Medway:Medway|\ GB:Merseyside:Merseyside|\ GB:MerthyrTydfil:Merthyr Tydfil |\ GB:Merton:Merton |\ GB:MidLothian:Mid Lothian|\ GB:Middlesborough:Middlesborough|\ GB:MiltonKeynes:Milton Keynes|\ GB:Mommouthshire:Mommouthshire|\ GB:Moray:Moray|\ GB:Moyle:Moyle|\ GB:Nah-EileananAnIar:Na h-Eileanan An Iar|\ GB:Neath,PortTalbot:Neath, Port Talbot|\ GB:Newcastle:Newcastle|\ GB:Newham:Newham |\ GB:Newport:Newport |\ GB:NewryMourne:Newry & Mourne|\ GB:Newtonabbey:Newtonabbey|\ GB:Norfolk:Norfolk|\ GB:NorthAyrshire:North Ayrshire|\ GB:NorthDown:North Down|\ GB:NorthEastLincolnshire:North East Lincolnshire|\ GB:NorthLanarkshire:North Lanarkshire|\ GB:NorthLincolnshire:North Lincolnshire|\ GB:NorthSomerset:North Somerset|\ GB:NorthTyneside:North Tyneside|\ GB:NorthYorkshire:North Yorkshire|\ GB:NorthYorkshire:North Yorkshire |\ GB:Northamptonshire:Northamptonshire|\ GB:Northumberland:Northumberland|\ GB:Nottingham:Nottingham |\ GB:Nottinghamshire:Nottinghamshire|\ GB:Omagh:Omagh|\ GB:OrkneyIsles:Orkney Isles|\ GB:Oxfordshire:Oxfordshire|\ GB:Pembrokeshire:Pembrokeshire|\ GB:PerthKinross:Perth & Kinross|\ GB:Peterborough:Peterborough|\ GB:Plymouth:Plymouth|\ GB:Poole:Poole|\ GB:Portsmouth:Portsmouth |\ GB:Powys:Powys|\ GB:Reading:Reading|\ GB:Redbridge:Redbridge |\ GB:RedcarCleveland:Redcar & Cleveland|\ GB:Renfrewshire:Renfrewshire|\ GB:Rhondda,Cynon,Taff:Rhondda, Cynon, Taff|\ GB:RichmondUponThames:Richmond Upon Thames |\ GB:Rotherham:Rotherham|\ GB:Rutland:Rutland |\ GB:Sandwell:Sandwell|\ GB:ScottishBorders:Scottish Borders|\ GB:Sheffield:Sheffield|\ GB:ShetlandIsles:Shetland Isles|\ GB:Shropshire:Shropshire|\ GB:Slough:Slough|\ GB:Solihull:Solihull|\ GB:Somerset:Somerset |\ GB:SouthAyrshire:South Ayrshire|\ GB:SouthGloucestershire:South Gloucestershire|\ GB:SouthLanarkshire:South Lanarkshire|\ GB:SouthTyneside:South Tyneside|\ GB:SouthYorkshire:South Yorkshire|\ GB:Southampton:Southampton |\ GB:SouthendonSea:Southend on Sea|\ GB:Southwark:Southwark|\ GB:Staffordshire:Staffordshire|\ GB:Stirling:Stirling |\ GB:StocktononTees:Stockton on Tees|\ GB:StokeonTrent:Stoke on Trent|\ GB:Strabane:Strabane|\ GB:Suffolk:Suffolk|\ GB:Sunderland:Sunderland |\ GB:Surrey:Surrey |\ GB:Sutton:Sutton |\ GB:Swansea:Swansea|\ GB:Swindon:Swindon|\ GB:TelfordWrekin:Telford & Wrekin|\ GB:Thurrock:Thurrock|\ GB:Torbay:Torbay|\ GB:Torfaen:Torfaen |\ GB:TowerHamlets:Tower Hamlets |\ GB:TyneWear:Tyne & Wear |\ GB:ValeofGlamorgan:Vale of Glamorgan |\ GB:Wakefield:Wakefield|\ GB:Walsall:Walsall|\ GB:WalthamForest:Waltham Forest |\ GB:Wandsworth:Wandsworth|\ GB:Warrington:Warrington|\ GB:Warwickshire:Warwickshire|\ GB:WestBerkshire:West Berkshire |\ GB:WestDumbartonshire:West Dumbartonshire|\ GB:WestLothian:West Lothian |\ GB:WestSussex:West Sussex|\ GB:WestYorkshire:West Yorkshire|\ GB:Westminister:Westminister |\ GB:Wiltshire:Wiltshire|\ GB:WindsorMaidenhead:Windsor & Maidenhead|\ GB:Wokingham:Wokingham|\ GB:Wolverhampton:Wolverhampton|\ GB:Worcestershire:Worcestershire|\ GB:Wrexham:Wrexham |\ GB:York:York|\ GB:London:London|\ GB:Herefordshire:Herefordshire|\ IE:CountyofSouthTipperary-Clonmel:County of South Tipperary - Clonmel |\ IE:CountyofSouthDublin-Tallaght:County of South Dublin - Tallaght |\ IE:CountyofNorthTipperary-Nenagh:County of North Tipperary - Nenagh |\ IE:CountyofFingal-Swords:County of Fingal - Swords |\ IE:CountyofDunLaoghaire-Rathdown-DúnLaoghaire:County of Dun Laoghaire-Rathdown - Dún Laoghaire |\ IE:CountyWicklow-Wicklow:County Wicklow - Wicklow |\ IE:CountyWexford-Wexford:County Wexford - Wexford |\ IE:CountyWestmeath-Mullingar:County Westmeath - Mullingar |\ IE:CountyWaterford-Waterford:County Waterford - Waterford |\ IE:CountyTipperary-Tipperary:County Tipperary - Tipperary |\ IE:CountySligo-Sligo:County Sligo - Sligo |\ IE:CountyRoscommon-Roscommon:County Roscommon - Roscommon |\ IE:CountyOffaly-Tullamore:County Offaly - Tullamore |\ IE:CountyMonaghan-Monaghan:County Monaghan - Monaghan |\ IE:CountyMeath-Trim(Navan-defacto):County Meath - Trim (Navan - de facto) |\ IE:CountyMayo-Castlebar:County Mayo - Castlebar |\ IE:CountyLouth-Dundalk:County Louth - Dundalk |\ IE:CountyLongford-Longford:County Longford - Longford |\ IE:CountyLimerick-Limerick:County Limerick - Limerick |\ IE:CountyLeitrim-Carrick-on-Shannon:County Leitrim - Carrick-on-Shannon |\ IE:CountyLaois-Portlaoise:County Laois - Portlaoise |\ IE:CountyKilkenny-Kilkenny:County Kilkenny - Kilkenny |\ IE:CountyKildare-Naas:County Kildare - Naas |\ IE:CountyKerry-Tralee:County Kerry - Tralee |\ IE:CountyGalway-Galway:County Galway - Galway |\ IE:CountyDublin-Dublin:County Dublin - Dublin |\ IE:CountyDonegal-Lifford:County Donegal - Lifford |\ IE:CountyCork-Cork:County Cork - Cork |\ IE:CountyClare-Ennis:County Clare - Ennis |\ IE:CountyCavan-Cavan:County Cavan - Cavan |\ IE:CountyCarlow-Carlow:County Carlow - Carlow |\ NB:County-Antrim:County-Antrim|\ NB:County-Armagh:County-Armagh|\ NB:County-Down:County-Down|\ NB:County-Fermanagh:County-Fermanagh|\ NB:County-Londonderry:County-Londonderry|\ NB:County-Tyrone:County-Tyrone|\ SF:Caithness:Caithness|\ SF:Sutherland:Sutherland |\ SF:CountyofRoss:County of Ross|\ SF:Cromartyshire:Cromartyshire |\ SF:Inverness-shire:Inverness-shire |\ SF:Nairnshire:Nairnshire |\ SF:CountyofMoray:County of Moray|\ SF:Banffshire:Banffshire |\ SF:Aberdeenshire:Aberdeenshire |\ SF:Kincardineshire:Kincardineshire |\ SF:Angus:Angus |\ SF:Perthshire:Perthshire |\ SF:Argyll:Argyll |\ SF:CountyofBute:County of Bute |\ SF:Ayrshire:Ayrshire |\ SF:Renfrewshire:Renfrewshire |\ SF:Dunbartonshire:Dunbartonshire|\ SF:Stirlingshire:Stirlingshire |\ SF:Clackmannanshire:Clackmannanshire|\ SF:Kinross-shire:Kinross-shire |\ SF:Fife:Fife |\ SF:WestLothian:West Lothian |\ SF:Midlothian:Midlothian |\ SF:EastLothian:East Lothian |\ SF:Berwickshire:Berwickshire |\ SF:Roxburghshire:Roxburghshire |\ SF:Dumfriesshire:Dumfriesshire |\ SF:Kirkcudbrightshire:Kirkcudbrightshire |\ SF:Wigtownshire:Wigtownshire |\ SF:Lanarkshire:Lanarkshire |\ SF:Selkirkshire:Selkirkshire |\ SF:Peeblesshire:Peeblesshire |\ SF:Zetland:Zetland |\ SF:Orkney:Orkney |\ CA:AB:Alberta|\ CA:BC:British Columbia|\ CA:MB:Manitoba|\ CA:NB:New Brunswick|\ CA:NFL:Newfoundland and Labrador|\ CA:NT:Northwest Territories|\ CA:NS:Nova Scotia|\ CA:ON:Ontario|\ CA:PE:Prince Edward Island|\ CA:QC:Quebec|\ CA:SK:Saskatchewan|\ CA:YT:Yukon Territory|\ '; // Country data table // // To edit the list, just delete a line or add a line. Order is important. // The order displayed here is the order it appears on the drop down. // var country = '\ AL:Albania|\ DZ:Algeria|\ AS:American Samoa|\ AD:Andorra|\ AO:Angola|\ AI:Anguilla|\ AG:Antigua & Barbuda|\ AR:Argentina|\ AM:Armenia|\ AW:Aruba|\ AU:Australia|\ AT:Austria|\ AP:Azores|\ BS:Bahamas|\ BH:Bahrain|\ BD:Bangladesh|\ BB:Barbados|\ BE:Belgium|\ BZ:Belize|\ BY:Belarus|\ BJ:Benin|\ BM:Bermuda|\ BT:Bhutan|\ BO:Bolivia|\ BL:Bonaire|\ BA:Bosnia|\ BW:Botswana|\ BR:Brazil|\ VG:British Virgin Islands|\ BN:Brunei|\ BG:Bulgaria|\ BF:Burkina Faso|\ BI:Burundi|\ KH:Cambodia|\ CM:Cameroon|\ CA:Canada|\ IC:Canary Islands|\ CV:Cape Verde Islands|\ KY:Cayman Islands|\ CF:Central African Republic|\ TD:Chad|\ CD:Channel Islands|\ CL:Chile|\ CN:China|\ CO:Colombia|\ CG:Congo|\ CK:Cook Islands|\ CR:Costa Rica|\ HR:Croatia|\ CB:Curacao|\ CY:Cyprus|\ CZ:Czech Republic|\ DK:Denmark|\ DJ:Djibouti|\ DM:Dominica|\ DO:Dominican Republic|\ EC:Ecuador|\ EG:Egypt|\ SV:El Salvador|\ EN:England|\ GQ:Equitorial Guinea|\ ER:Eritrea|\ EE:Estonia|\ ET:Ethiopia|\ FO:Faeroe Islands|\ FM:Federated States of Micronesia|\ FJ:Fiji|\ FI:Finland|\ FR:France|\ GF:French Guiana|\ PF:French Polynesia|\ GA:Gabon|\ GM:Gambia|\ GE:Georgia|\ DE:Germany|\ GH:Ghana|\ GI:Gibraltar|\ GR:Greece|\ GL:Greenland|\ GD:Grenada|\ GP:Guadeloupe|\ GU:Guam|\ GT:Guatemala|\ GN:Guinea|\ GW:Guinea-Bissau|\ GY:Guyana|\ HT:Haiti|\ HO:Holland|\ HN:Honduras|\ HK:Hong Kong|\ HU:Hungary|\ IS:Iceland|\ IN:India|\ ID:Indonesia|\ IQ:Iraq|\ IR:Iran|\ IL:Israel|\ IT:Italy|\ CI:Ivory Coast|\ JM:Jamaica|\ JP:Japan|\ JO:Jordan|\ KZ:Kazakhstan|\ KE:Kenya|\ KI:Kiribati|\ KO:Kosrae|\ KW:Kuwait|\ KG:Kyrgyzstan|\ LA:Laos|\ LV:Latvia|\ LB:Lebanon|\ LS:Lesotho|\ LR:Liberia|\ LY:Libya|\ LI:Liechtenstein|\ LT:Lithuania|\ LU:Luxembourg|\ MO:Macau|\ MK:Macedonia|\ MG:Madagascar|\ ME:Madeira|\ MW:Malawi|\ MY:Malaysia|\ MV:Maldives|\ ML:Mali|\ MT:Malta|\ MH:Marshall Islands|\ MQ:Martinique|\ MR:Mauritania|\ MU:Mauritius|\ MX:Mexico|\ MD:Moldova|\ MC:Monaco|\ MN:Monogolia|\ MS:Montserrat|\ MA:Morocco|\ MZ:Mozambique|\ MM:Myanmar|\ NA:Namibia|\ NR:Nauru|\ NP:Nepal|\ NL:Netherlands|\ AN:Netherlands Antilles|\ NC:New Caledonia|\ NZ:New Zealand|\ NI:Nicaragua|\ NE:Niger|\ NG:Nigeria|\ NF:Norfolk Island|\ NB:Northern Ireland|\ MP:Northern Mariana Islands|\ NO:Norway|\ OM:Oman|\ PK:Pakistan|\ PW:Palau|\ PA:Panama|\ PG:Papua New Guinea|\ PY:Paraguay|\ PE:Peru|\ PH:Philippines|\ PN:Pitcairn Island|\ PL:Poland|\ PO:Ponape|\ PT:Portugal|\ PR:Puerto Rico|\ QA:Qatar|\ IE:Republic of Ireland|\ YE:Republic of Yemen|\ RE:Reunion|\ RO:Romania|\ RT:Rota|\ RU:Russia|\ RW:Rwanda|\ SS:Saba|\ SP:Saipan|\ SM:San Marino|\ ST:Sao Tome and Principe|\ SA:Saudi Arabia|\ SF:Scotland|\ SN:Senegal|\ SC:Seychelles|\ SL:Sierra Leone|\ SG:Singapore|\ SK:Slovakia|\ SI:Slovenia|\ SB:Solomon Islands|\ ZA:South Africa|\ KR:South Korea|\ ES:Spain|\ LK:Sri Lanka|\ NT:St. Barthelemy|\ SW:St. Christopher|\ SX:St. Croix|\ EU:St. Eustatius|\ UV:St. John|\ KN:St. Kitts & Nevis|\ LC:St. Lucia|\ MB:St. Maarten|\ TB:St. Martin|\ VL:St. Thomas|\ VC:St. Vincent & the Grenadines|\ SD:Sudan|\ SR:Suriname|\ SZ:Swaziland|\ SE:Sweden|\ CH:Switzerland|\ SY:Syria|\ TA:Tahiti|\ TW:Taiwan|\ TJ:Tajikistan|\ TZ:Tanzania|\ TH:Thailand|\ TI:Tinian|\ TG:Togo|\ TO:Tonga|\ TL:Tortola|\ TT:Trinidad & Tobago|\ TU:Truk|\ TN:Tunisia|\ TR:Turkey|\ TM:Turkmenistan|\ TC:Turks & Caicos Islands|\ TV:Tuvalu|\ UG:Uganda|\ UA:Ukraine|\ UI:Union Island|\ AE:United Arab Emirates|\ GB:United Kingdom|\ US:United States|\ UY:Uruguay|\ VI:US Virgin Islands|\ UZ:Uzbekistan|\ VU:Vanuatu|\ VA:Vatican City|\ VE:Venezuela|\ VN:Vietnam|\ VR:Virgin Gorda|\ WK:Wake Island|\ WL:Wales|\ WF:Wallis & Futuna Islands|\ WS:Western Samoa|\ YA:Yap|\ YU:Yugoslavia|\ ZR:Zaire|\ ZM:Zambia|\ ZW:Zimbabwe|\ '; country = country.substring(0, country.length-1) // Deleting the last "|" character function get_Element(i) { return document.getElementById(i) || document.getElementsByName(i).item(0); } function TrimString(sInString) { if ( sInString ) { sInString = sInString.replace( /^\s+/g, "" );// strip leading return sInString.replace( /\s+$/g, "" );// strip trailing } } // Populates the country selected with the counties from the country list function populateCountry(defaultCountry,countryfieldname) { if (defaultCountry=="") {defaultCountry="US"} var countryLineArray = country.split('|'); // Split into lines var selObj = get_Element(countryfieldname); selObj.options[0] = new Option('',''); selObj.selectedIndex = 0; for (var loop = 0; loop < countryLineArray.length; loop++) { lineArray = countryLineArray[loop].split(':'); countryCode = TrimString(lineArray[0]); countryName = TrimString(lineArray[1]); if ( countryCode != '' ) { selObj.options[loop] = new Option(countryName, countryCode); } if ( defaultCountry == countryCode ) { selObj.selectedIndex = loop; } } } function populateState(statefieldname,countryfieldname,state1,optionalCreateTextField) { //optionalCreateTextField = optional parameter, true/false. When a country doesn't have state, it'll determine if the code creates a text field for the state or just let the dropdown empty. var isOpera = false, isIE = false; var strClassName; if(typeof(window.opera) != 'undefined') {isOpera = true;} if(!isOpera && (navigator.userAgent.indexOf('Internet Explorer') > 0 || navigator.userAgent.indexOf('MSIE') > 0)) {isIE = true;} if (state1==undefined) {state1='';} postCountry=get_Element(countryfieldname); postCountry=postCountry.value; var selObj = get_Element(statefieldname); var foundState = false; // Empty options just in case new drop down is shorter if ( selObj.type == 'select-one' ) { selObj.options.length = 0; // selObj.options[0] = new Option('Select State',''); // selObj.selectedIndex = 0; } // Populate the drop down with states from the selected country // var stateLineArray = stateList.split("|"); // Split into lines var optionCntr = 0; for (var loop = 0; loop < stateLineArray.length; loop++) { lineArray = stateLineArray[loop].split(":"); countryCode = TrimString(lineArray[0]); stateCode = TrimString(lineArray[1]); stateName = TrimString(lineArray[2]); if ( get_Element(countryfieldname).value == countryCode && countryCode != '' ) { // If it's a input element, change it to a select // if ( selObj.type == 'text' ) { strClassName = selObj.className; parentObj = get_Element(statefieldname).parentNode; parentObj.removeChild(selObj); // Create the Input Field if(!isIE){ var inputSel = document.createElement("SELECT"); inputSel.setAttribute("name", statefieldname); if (strClassName != 'undefined' && strClassName != '') inputSel.setAttribute("class",strClassName); else inputSel.setAttribute("class","txtBoxStyle"); inputSel.setAttribute("id", statefieldname); } else { var inputSel = document.createElement(""); if (strClassName != 'undefined' && strClassName != '') inputEl.setAttribute("className",strClassName); else inputEl.setAttribute("className","txtBoxStyle"); } inputEl.setAttribute("type", "text"); inputEl.setAttribute("size", 20); inputEl.setAttribute("value", state1); parentObj.appendChild(inputEl); } } } } function insertCountry(strCountryName,countryfieldname) { var selObj = get_Element(countryfieldname); selObj.options[selObj.options.length] = new Option('ALL','ALL'); selObj.selectedIndex = selObj.options.length-1; } function initCountry(country,state1,statefieldname,countryfieldname) { populateCountry(country,countryfieldname); populateState(statefieldname,countryfieldname,state1); } function GetValue(formx,name1) { //alert(name1); var i; for(i=0;i