/* 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 = '\ GB:Aberdeen:Aberdeen|\ GB:Aberdeenshire:Aberdeenshire|\ SF:Aberdeenshire:Aberdeenshire |\ US:AL:Alabama|\ US:AK:Alaska|\ CA:AB:Alberta|\ SF:Angus:Angus |\ GB:Angus:Angus|\ GB:Ards:Ards|\ SF:Argyll:Argyll |\ GB:ArgyllandBute:Argyll and Bute|\ US:AZ:Arizona|\ US:AR:Arkansas|\ GB:Armagh:Armagh|\ AU:ACT:Australian Capital Territory|\ SF:Ayrshire:Ayrshire |\ GB:Ballymena:Ballymena|\ GB:Ballymoney:Ballymoney|\ GB:Banbridge:Banbridge|\ SF:Banffshire:Banffshire |\ 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|\ SF:Berwickshire:Berwickshire |\ 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|\ CA:BC:British Columbia|\ GB:Bromley:Bromley |\ GB:Buckinghamshire:Buckinghamshire|\ GB:Caerphilly:Caerphilly |\ SF:Caithness:Caithness|\ GB:Calderdale:Calderdale|\ US:CA:California|\ 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|\ SF:Clackmannanshire:Clackmannanshire|\ GB:Coleraine:Coleraine|\ US:CO:Colorado|\ US:CT:Connecticut|\ GB:Conwy:Conwy|\ GB:Cookstown:Cookstown|\ GB:CornwallIslesofScilly:Cornwall & Isles of Scilly|\ IE:CountyCarlow-Carlow:County Carlow - Carlow |\ IE:CountyCavan-Cavan:County Cavan - Cavan |\ IE:CountyClare-Ennis:County Clare - Ennis |\ IE:CountyCork-Cork:County Cork - Cork |\ IE:CountyDonegal-Lifford:County Donegal - Lifford |\ IE:CountyDublin-Dublin:County Dublin - Dublin |\ IE:CountyGalway-Galway:County Galway - Galway |\ IE:CountyKerry-Tralee:County Kerry - Tralee |\ IE:CountyKildare-Naas:County Kildare - Naas |\ IE:CountyKilkenny-Kilkenny:County Kilkenny - Kilkenny |\ IE:CountyLaois-Portlaoise:County Laois - Portlaoise |\ IE:CountyLeitrim-Carrick-on-Shannon:County Leitrim - Carrick-on-Shannon |\ IE:CountyLimerick-Limerick:County Limerick - Limerick |\ IE:CountyLongford-Longford:County Longford - Longford |\ IE:CountyLouth-Dundalk:County Louth - Dundalk |\ IE:CountyMayo-Castlebar:County Mayo - Castlebar |\ IE:CountyMeath-Trim(Navan-defacto):County Meath - Trim (Navan - de facto) |\ IE:CountyMonaghan-Monaghan:County Monaghan - Monaghan |\ SF:CountyofBute:County of Bute |\ IE:CountyofDunLaoghaire-Rathdown-DúnLaoghaire:County of Dun Laoghaire-Rathdown - Dún Laoghaire |\ IE:CountyofFingal-Swords:County of Fingal - Swords |\ SF:CountyofMoray:County of Moray|\ IE:CountyofNorthTipperary-Nenagh:County of North Tipperary - Nenagh |\ SF:CountyofRoss:County of Ross|\ IE:CountyofSouthDublin-Tallaght:County of South Dublin - Tallaght |\ IE:CountyofSouthTipperary-Clonmel:County of South Tipperary - Clonmel |\ IE:CountyOffaly-Tullamore:County Offaly - Tullamore |\ IE:CountyRoscommon-Roscommon:County Roscommon - Roscommon |\ IE:CountySligo-Sligo:County Sligo - Sligo |\ IE:CountyTipperary-Tipperary:County Tipperary - Tipperary |\ IE:CountyWaterford-Waterford:County Waterford - Waterford |\ IE:CountyWestmeath-Mullingar:County Westmeath - Mullingar |\ IE:CountyWexford-Wexford:County Wexford - Wexford |\ IE:CountyWicklow-Wicklow:County Wicklow - Wicklow |\ 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|\ GB:Coventry:Coventry|\ GB:Craigavon:Craigavon|\ SF:Cromartyshire:Cromartyshire |\ GB:Croydon:Croydon |\ GB:Cumbria:Cumbria|\ GB:Darlington:Darlington|\ US:DE:Delaware|\ GB:Denbighshire:Denbighshire|\ GB:Derby:Derby |\ GB:Derbyshire:Derbyshire|\ GB:Derry:Derry|\ GB:Devon:Devon|\ US:DC:District of Columbia|\ GB:Doncaster:Doncaster|\ GB:Dorset:Dorset|\ GB:Down:Down|\ GB:Dudley:Dudley|\ GB:DumfriesGalloway:Dumfries & Galloway|\ SF:Dumfriesshire:Dumfriesshire |\ SF:Dunbartonshire:Dunbartonshire|\ GB:Dundee:Dundee|\ GB:Dungannon:Dungannon|\ GB:Durham:Durham|\ GB:Ealing:Ealing |\ GB:EastAyrshire:East Ayrshire|\ GB:EastDumbartonshire:East Dumbartonshire|\ SF:EastLothian:East Lothian |\ 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|\ SF:Fife:Fife |\ GB:Flintshire:Flintshire|\ US:FL:Florida|\ GB:Gateshead:Gateshead|\ US:GA:Georgia|\ 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 |\ US:HI:Hawaii|\ GB:Herefordshire:Herefordshire|\ GB:Hertfordshire:Hertfordshire|\ GB:Highland:Highland|\ GB:Hillingdon:Hillingdon |\ GB:Hounslow:Hounslow |\ US:ID:Idaho|\ US:IL:Illinois|\ US:IN:Indiana|\ GB:Inverclyde:Inverclyde|\ SF:Inverness-shire:Inverness-shire |\ US:IA:Iowa|\ GB:IsleofAnglesey:Isle of Anglesey|\ GB:IsleofWight:Isle of Wight|\ GB:Islington:Islington |\ US:KS:Kansas|\ GB:KensingtonChelsea:Kensington & Chelsea |\ GB:Kent:Kent|\ US:KY:Kentucky|\ SF:Kincardineshire:Kincardineshire |\ GB:KingstonuponHull:Kingston upon Hull|\ GB:KingstonUponThames:Kingston Upon Thames |\ SF:Kinross-shire:Kinross-shire |\ SF:Kirkcudbrightshire:Kirkcudbrightshire |\ GB:Kirklees:Kirklees|\ GB:Lambeth:Lambeth|\ SF:Lanarkshire:Lanarkshire |\ 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:London:London|\ US:LA:Louisiana|\ GB:Luton:Luton|\ GB:Magherafelt:Magherafelt|\ US:ME:Maine|\ CA:MB:Manitoba|\ US:MD:Maryland|\ US:MA:Massachusetts|\ GB:Medway:Medway|\ GB:Merseyside:Merseyside|\ GB:MerthyrTydfil:Merthyr Tydfil |\ GB:Merton:Merton |\ US:MI:Michigan|\ GB:MidLothian:Mid Lothian|\ GB:Middlesborough:Middlesborough|\ SF:Midlothian:Midlothian |\ GB:MiltonKeynes:Milton Keynes|\ US:MN:Minnesota|\ US:MS:Mississippi|\ US:MO:Missouri|\ GB:Mommouthshire:Mommouthshire|\ US:MT:Montana|\ GB:Moray:Moray|\ GB:Moyle:Moyle|\ GB:Nah-EileananAnIar:Na h-Eileanan An Iar|\ SF:Nairnshire:Nairnshire |\ GB:Neath,PortTalbot:Neath, Port Talbot|\ US:NE:Nebraska|\ US:NV:Nevada|\ CA:NB:New Brunswick|\ US:NH:New Hampshire|\ US:NJ:New Jersey|\ US:NM:New Mexico|\ AU:NSW:New South Wales|\ US:NY:New York|\ GB:Newcastle:Newcastle|\ CA:NFL:Newfoundland and Labrador|\ GB:Newham:Newham |\ GB:Newport:Newport |\ GB:NewryMourne:Newry & Mourne|\ GB:Newtonabbey:Newtonabbey|\ GB:Norfolk:Norfolk|\ GB:NorthAyrshire:North Ayrshire|\ US:NC:North Carolina|\ US:ND:North Dakota|\ 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|\ AU:NT:Northern Territory|\ GB:Northumberland:Northumberland|\ CA:NT:Northwest Territories|\ GB:Nottingham:Nottingham |\ GB:Nottinghamshire:Nottinghamshire|\ CA:NS:Nova Scotia|\ US:OH:Ohio|\ US:OK:Oklahoma|\ GB:Omagh:Omagh|\ CA:ON:Ontario|\ US:OR:Oregon|\ SF:Orkney:Orkney |\ GB:OrkneyIsles:Orkney Isles|\ GB:Oxfordshire:Oxfordshire|\ SF:Peeblesshire:Peeblesshire |\ GB:Pembrokeshire:Pembrokeshire|\ US:PA:Pennsylvania|\ GB:PerthKinross:Perth & Kinross|\ SF:Perthshire:Perthshire |\ GB:Peterborough:Peterborough|\ GB:Plymouth:Plymouth|\ GB:Poole:Poole|\ GB:Portsmouth:Portsmouth |\ GB:Powys:Powys|\ CA:PE:Prince Edward Island|\ US:PR:Puerto Rico|\ CA:QC:Quebec|\ AU:QLD:Queensland|\ GB:Reading:Reading|\ GB:Redbridge:Redbridge |\ GB:RedcarCleveland:Redcar & Cleveland|\ SF:Renfrewshire:Renfrewshire |\ GB:Renfrewshire:Renfrewshire|\ US:RI:Rhode Island|\ GB:Rhondda,Cynon,Taff:Rhondda, Cynon, Taff|\ GB:RichmondUponThames:Richmond Upon Thames |\ GB:Rotherham:Rotherham|\ SF:Roxburghshire:Roxburghshire |\ GB:Rutland:Rutland |\ GB:Sandwell:Sandwell|\ CA:SK:Saskatchewan|\ GB:ScottishBorders:Scottish Borders|\ SF:Selkirkshire:Selkirkshire |\ GB:Sheffield:Sheffield|\ GB:ShetlandIsles:Shetland Isles|\ GB:Shropshire:Shropshire|\ GB:Slough:Slough|\ GB:Solihull:Solihull|\ GB:Somerset:Somerset |\ AU:SA:South Australia|\ GB:SouthAyrshire:South Ayrshire|\ US:SC:South Carolina|\ US:SD:South Dakota|\ 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 |\ SF:Stirlingshire:Stirlingshire |\ GB:StocktononTees:Stockton on Tees|\ GB:StokeonTrent:Stoke on Trent|\ GB:Strabane:Strabane|\ GB:Suffolk:Suffolk|\ GB:Sunderland:Sunderland |\ GB:Surrey:Surrey |\ SF:Sutherland:Sutherland |\ GB:Sutton:Sutton |\ GB:Swansea:Swansea|\ GB:Swindon:Swindon|\ AU:TAS:Tasmania|\ GB:TelfordWrekin:Telford & Wrekin|\ US:TN:Tennessee|\ US:TX:Texas|\ GB:Thurrock:Thurrock|\ GB:Torbay:Torbay|\ GB:Torfaen:Torfaen |\ GB:TowerHamlets:Tower Hamlets |\ GB:TyneWear:Tyne & Wear |\ US:UT:Utah|\ GB:ValeofGlamorgan:Vale of Glamorgan |\ US:VT:Vermont|\ AU:VIC:Victoria|\ US:VI:Virgin Islands|\ US:VA:Virginia|\ GB:Wakefield:Wakefield|\ GB:Walsall:Walsall|\ GB:WalthamForest:Waltham Forest |\ GB:Wandsworth:Wandsworth|\ GB:Warrington:Warrington|\ GB:Warwickshire:Warwickshire|\ US:WA:Washington|\ GB:WestBerkshire:West Berkshire |\ GB:WestDumbartonshire:West Dumbartonshire|\ SF:WestLothian:West Lothian |\ GB:WestLothian:West Lothian |\ GB:WestSussex:West Sussex|\ US:WV:West Virginia|\ GB:WestYorkshire:West Yorkshire|\ AU:WA:Western Australia|\ GB:Westminister:Westminister |\ SF:Wigtownshire:Wigtownshire |\ GB:Wiltshire:Wiltshire|\ GB:WindsorMaidenhead:Windsor & Maidenhead|\ US:WI:Wisconsin|\ GB:Wokingham:Wokingham|\ GB:Wolverhampton:Wolverhampton|\ GB:Worcestershire:Worcestershire|\ GB:Wrexham:Wrexham |\ US:WY:Wyoming|\ GB:York:York|\ CA:YT:Yukon Territory|\ SF:Zetland:Zetland |\ '; // 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|\ BY:Belarus|\ BE:Belgium|\ BZ:Belize|\ 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|\ CI:Cote Divoire|\ 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|\ 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|\ VA:Holy See (Vatican City State)|\ HN:Honduras|\ HK:Hong Kong|\ 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|\ KR:Korea, Republic of|\ KO:Kosrae|\ KW:Kuwait|\ KG:Kyrgyzstan|\ LA:Laos|\ LV:Latvia|\ LB:Lebanon|\ LS:Lesotho|\ LR:Liberia|\ LY:Libyan Arab Jamahiriya|\ LI:Liechtenstein|\ LT:Lithuania|\ LU:Luxembourg|\ MO:Macau|\ MK:Macedonia, Republic of|\ MG:Madagascar|\ MW:Malawi|\ MY:Malaysia|\ MV:Maldives|\ ML:Mali|\ MT:Malta|\ MH:Marshall Islands|\ MQ:Martinique|\ MR:Mauritania|\ MU:Mauritius|\ MX:Mexico|\ FM:Micronesia, Federated States of|\ MD:Moldova|\ MC:Monaco|\ MN:Monogolia|\ ME:Montenegro, Republic of|\ 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|\ 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|\ 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:Syrian Arab Republic|\ TA:Tahiti|\ TW:Taiwan|\ TJ:Tajikistan|\ TZ:Tanzania|\ TH:Thailand|\ TL:Timor-Leste|\ TI:Tinian|\ TG:Togo|\ TO:Tonga|\ TT:Trinidad and 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|\ VE:Venezuela|\ VN:Vietnam|\ VR:Virgin Gorda|\ WK:Wake Island|\ WL:Wales|\ WF:Wallis and Futuna|\ WS:Western Samoa|\ YA:Yap|\ YE:Yemen|\ 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