function showState(country,countrycode,state)
{
	// OCXstate will contain a value if the user stored his state in the OCX
	var i,j
	var CountryStates = new Array() 
	CountryStates["Australia"] 		= "Select State~Australia Capital Territory~Western Australia~New South Wales~Tasmania~South Australia~Northern Territory~Queensland~Victoria"
	CountryStates["Canada"] 		= "Select State~Alberta~British Columbia~Manitoba~Nanuvut~New Brunswick~Newfoundland~Nova Scotia~NW Territories~Ontario~Prince Edward Is~Quebec~Saskatchewan~Yukon"
	CountryStates["United States of America"] = "Select State~Alabama~Alaska~Arizona~Arkansas~California~Colorado~Connecticut~Delaware~Florida~Georgia~Hawaii~Idaho~Illinois~Indiana~Iowa~Kansas~Kentucky~Louisiana~Maine~Maryland~Massachusetts~Michigan~Minnesota~Mississippi~Missouri~Montana~Nebraska~Nevada~New Hampshire~New Jersey~New Mexico~New York~North Carolina~North Dakota~Ohio~Oklahoma~Oregon~Pennsylvania~Rhode Island~South Carolina~South Dakota~Tennessee~Texas~Utah~Vermont~Virginia~Washington~West Virginia~Wisconsin~Wyoming"
	CountryStates["United Arab Emirates"]= "Select State~Dubai~Abu Dhabi~Sharjah~Ajman~Fujeirah~Ras Al-Khaima~Umm Al-Qaiwain"
	CountryStates["Austria"] 		= "Select State~Burgenland~Karnten~NiederOsterreich~OberOsterreich~Osttirol~Salzburg~Steiermark~Tirol~Vienna~Vorarlberg"
	CountryStates["Bangladesh"]		= "Select State~Dhaka~Chiitagong~Khulna~Others"
	CountryStates["Belgium"] 		= "Select State~Antwerp~Brabant~East Flanders~Hainaut~Liege~Limburg~Luxembourg~Namur~West Flanders"
	CountryStates["Bulgaria"] 		="Select State~Burgas~Khaskovo~Lovech~Mikhailovgrad~Plovdiv"	
	CountryStates["China"]			= "Select State~Beijing~Shanghai~Tianjin~Chongqing~Heilongjiang~Jilin~Liaoning~Hebei~Henan~Shandong~Shanxi~Shaanxi~Neimenggu~Gansu~Ningxia~Xinjiang~Qinghai~Xizang~Zhejiang~Jiangsu~Jiangxi~Anhui~Hunan~Hubei~Guangdong~Guangxi~Fujian~Hainan~Sichuan~Yunnan~Guizhou~Hong Kong~Macao"
	CountryStates["Czech Republic"] = "Select State~Jihocesky~Jihomoravsky~Prague~Severocesky~Severomoravsky~Stredocesky~Vchodocesky~Zapadocesky"
	CountryStates["Denmark"] 		= "Select State~Aarhus~Bornholm~Fyn~Kobenhavns~Nordjylland~Ribe~Ringkobing~Roskilde~Sonderjylland~Storstrom~Vejle~Vetsjaelland~Viborg"
	CountryStates["Egypt"]			= "Select State~Cairo~Alexandria~Luxor~Others"
	CountryStates["Finland"] 		= "Select State~Ahvenanmaa~Hame~Keski-Suomi~Kuopio~Kymi~Lappi~Mikkeli~Oulu~Pohjois-Karjala~Turku-Pori~Uusimaa~Vaasa"
    CountryStates["France"]  		= "Select State~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"
	CountryStates["Germany"]		= "Select State~BadenWurtemberg~Bavaria~Berlin~Brandenburg~Bremen~Hamburg~Hessen~Lower Saxony~Mecklenburg-West Pomerania~Niedersachsen~North Rhine-Westphalia~Rheinland-Pfalz~Saarland~Saxony~Saxony-Anhalt~Schleswig-Holstein~Thuringia"
	CountryStates["Greece"] 		= "Select State~Aegan North~Aegan South~Crete~Epirus~Greece Central~Greece West~Ionian Islands~Macedonia Central~Macedonia East~Macedonia West~Peloponnese~Thessaly"
	CountryStates["Hong Kong SAR, PRC"]  = "Select State~Hong Kong Island~Kowloon~New Territories"
	CountryStates["Hungary"] 		= "Select State~Bacs-Kiskun~Baranya~Bekes~Borsod-Abauj-Zemplen~Budapest~Csongrad~Fejer~Gyor-Moson-Sopron~Hajdu-Bihar~Heves~Jasz-Nagkyun-Szolnok~Komarom-Esztergom~Nograd~Pest~Somogy~Szabolcs-Szatmar-Bereg~Tolna~Vas~Veszprem~Zala"
	CountryStates["India"] 			= "Select State~New Delhi~Mumbai (Bombay)~Bangalore~Chennai (Madras)~Calcutta~Others"
	CountryStates["Indonesia"]		= "Select State~Jakarta~Surabaya~Bandung~Medan~Others"
	CountryStates["Ireland"] 		= "Select State~Carlow~Cavan~Clare~Cork~Donegal~Dublin~Kerry~Kildare~Kilkenny~Laois~Leitrim~Limerick~Longford~Louth~Mayo~Meath~Monaghan~Offaly~Roscommon~Sligo~Tipperary NR~Tipperary SR~Waterford~Westmeath~Wexford~Wicklow"	
	CountryStates["Israel"]			= "Select State~Tel-Aviv~Others"
	CountryStates["Japan"]			=  '選択してください~北海道~青森~岩手~秋田~宮城~山形~福島~茨城~栃木~群馬~千葉~埼玉~東京~神奈川~山梨~新潟~長野~静岡~岐阜~愛知~富山~石川~福井~滋賀~三重~京都~奈良~大阪~和歌山~兵庫~岡山~広島~鳥取~島根~山口~香川~徳島~愛媛~高知~福岡~佐賀~長崎~大分~熊本~宮崎~鹿児島~沖縄'
//	CountryStates["Japan"]	= "Select State~Aomori~Iwate~Akita~Miyagi~Yamagata~Fukushima~Ibaragi~Tochigi~Gunma~Chiba~Saitama~Tokyo~Kanagawa~Yamanashi~Niigata~Nagano~Shizuoka~Gifu~Aichi~Toyama~Ishikawa~Fukui~Shiga~Mie~Kyoto~Nara~Osaka~Wakayama~Hyogo~Okayama~Hiroshima~Tottori~Shimane~Yamaguchi~Kagawa~Tokushima~Ehime~Kochi~Fukuoka~Saga~Nagasaki~Oita~Kumamoto~Miyazaki~Kagoshima~Okinawa~Hokkaido"
	CountryStates["Korea (Republic of)"]= "Select State~Gyeonggi-Do~Gangwon-Do~Chungcheongnam-Do~Chungcheongbuk-Do~Gyoengsanam-Do~Gyoengsangbuk-Do~Jeollanam-Do~Jeollabuk-Do~Jeju-Do"
	CountryStates["Maldives"]		= "Select State~Male~Others"
	CountryStates["Mauritius"]		= "Select State~Port Louis~Beau Bassin~Curepipe~Others"
	CountryStates["Netherlands"] 	= "Select State~Drenthe~Friesland~Gelderland~Groningen~Limburg~Noord-Brabant~Noord-Holland~Overijssel~Utrecht~Zeeland~Zuid-Holland"
	CountryStates["New Zealand"]	= "Select State~Auckland~Bay of Plenty~Canterbury~Coromandel~Gisborne~Hawkes Bay~Manawatu - Wanganui~Marlborough~Northland~Otago~Queenstown - Wanaka~Rotorua - Taupo~Southland~Taranaki~Tasman - Nelson~Waikato~Wellington~West Coast~Others"
	CountryStates["Norway"] 		= "Select State~Akershus~Aust-Agder~Buskerud~Finnmark~Hedmark~Hordaland~More og Romsdal~Nord-Trondelag~Nordland~Oslo~Ostfold~Rogaland~Sogn og Fjordane~Sor-Trondelag~Telemark~Troms~Vest-Agder~Vestfold"
	CountryStates["Pakistan"]		= "Select State~Karachi~Lahore~Faisalabad~Others"
	CountryStates["Philippines"]	= "Select State~Manila~Others"
	CountryStates["Poland"] 		= "Select State~Biala Podlaska~Bialystok~Bielsko-Biala~Bydgoszcz~Chelm~Ciechanow~Czestochowa~Elblag~Gdansk~Gorzow~Jelenia Gora~Kalisz~Katowice~Kielce~Konin~Koszalin~Krakow~Krosno~Legnica~Leszno~Lodz~Lomza~Lublin~Nowy Sacz~Olsztyn~Opole~Ostroteka~Pila~Piotrkow~Plock~Poznan~Przemysl~Radom~Rzeszow~Siedice~Sieradz~Skierniewice~Slupsk~Suwalki~Szczecin~Tarnobrzeg~Tarnow~Torun~Walbrzych~Warsaw~Wloclawek~Wroclaw~Zamosc~Zielona Gora"
	CountryStates["Portugal"] 		= "Select State~Aveiro~Beja~Braga~Braganca~Castelo Branco~Coimbra~Evora~Faro~Guarda~Leiria~Lisboa~Portalegre~Porto~Santarem~Setubal~Viana de Castelo~Vila Real~Viseu"
	CountryStates["Romania"] 		= "Select State~Alba~Arad~Arges~Bacau~Bihor~Bistrita-Nasaud~Botosani~Braila~Brasov~Bucharest~Buzau~Calarasi~Caras-Severin~Cluj~Costanza~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"
	CountryStates["Saudi Arabia"]	= "Select State~Riyadh~Jeddah~Others"
	CountryStates["South Africa"]   = "Select State~Cape of Good Hope~Cape Province~Eastern Cape Province~Free State Province~Gauteng~Limpopo Province~Mpumalanga~Natal~Northern Cape Province~Northern Province~North West Province~Orange River Colony~Oranje Vrijstaat~Orange Free State ?Orange Vrijstaat~Transvaal~Western Cape Province~Zuid Afrikaansche Republiek"
	CountryStates["Spain"] 			= "Select State~Andalusia~Aragon~Asturia~Baleares~Basque County~Canary Islands~Cantabria~Castilla y Leon~Castilla-La Mancha~Catalonia~Ceuta~Extremedura~Galacia~La Rioja~Madrid~Melilla~Murcia~Navarra~Valencia"
	CountryStates["Sri Lanka"]		= "Select State~Colombo~Dehiwela~Moratuwa~Others"
	CountryStates["Sweden"] 		= "Select State~Alvsborg~Blekinge~Gavleborg~Goteborg and Bohus~Gotland~Halland~Jamtland~Jonkoping~Kalmar~Kristianstad~Kronoberg~Malmohus~Norrbotten~Orebro~Ostergotland~Skaraborg~Sodermanland~Stockholm~Uppsala~Varmland~Vasterbotten~Vasternorrland~Vastmanland"
	CountryStates["Switzerland"] 	= "Select State~Aargau~Appenzell-Inner Rhoden~Appenzell-Outer Rhoden~Basel-Land~Basel-Town~Berne~Fribourg~Geneva~Glarus~Graubunden~Jura~Luzern~Neuchatel~Nidwalden~Obwalden~Schaffhausen~Schwyz~Solothurn~St. Gallen~Thurgau~Ticino~Unterwalden~Uri~Valais~Vaud~Zug~Zurich"
	CountryStates["Thailand"]		= "Select State~Bangkok~Khon Kaen~Others"
	CountryStates["Turkey"]			= "Select State~Ankara~Istanbul~Izmir~Others"
	CountryStates["United Kingdom"] = "Select County~Aberconwy and Colwyn~Aberdeen City~Aberdeenshire~Anglesey~Angus~Antrim~Argyll and  Bute~Armagh~Avon~Ayrshire~Bath & NE Somerset~Bedfordshire~Berkshire~Berwickshire~BFPO~Blaenau Gwent~Buckinghamshire~Caernarfonshire~Caerphilly~Caithness~Cambridgeshire~Cardiff~Cardiganshire~Carmarthenshire~Ceredigion~Channel Islands~Cheshire~City of Bristol~Clackmannanshire~Clwyd~Conwy~Cornwall/Scilly~Cumbria~Denbighshire~Derbyshire~Devon~Dorset~Down~Dumfries & Galloway~Dunbartonshire~Dundee~Durham~Dyfed~East Ayrshire~East Dunbartonshire~East Lothian~East Renfrewshire~East Riding Yorkshire~East Sussex~Edinburgh~Essex~Falkirk~Fermanagh~Fife~Flintshire~Glasgow~Gloucestershire~Greater London~Greater Manchester~Gwent~Gwynedd~Hampshire~Hartlepool~Hereford  & Worcester~Hertfordshire~Highlands~Inverclyde~Inverness-Shire~Isle of Man~Isle of Wight~Kent~Kincardinshire~Kingston Upon Hull~Kinross-Shire~Kirklees~Lanarkshire~Lancashire~Leicestershire~Lincolnshire~Londonderry~Merseyside~Merthyr Tydfil~Mid  Glamorgan~Middlesex~Midlothian~Monmouthshire~Moray~Neath &  Port Talbot~Newport~Norfolk~North Ayrshire~North East Lincolnshire~North Lanarkshire~North Lincolnshire~North Somerset~North Yorkshire~Northamptonshire~Northumberland~Nottinghamshire~Orkney~Oxfordshire~Pembrokeshire~Perth and Kinross~Powys~Redcar & Cleveland~Renfrewshire~Rhonda Cynon Taff~Rutland~Scottish Borders~Shetland~Shropshire~Somerset~South  Glamorgan~South Ayrshire~South Gloucesteshire~South Lanarkshire~South Yorkshire~Staffordshire~Stirling~Stockton On Tees~Suffolk~Surrey~Swansea~Torfaen~Tyne and Wear~Tyrone~Vale Of  Glamorgan~Warwickshire~West Dunbartonshire~West Glamorgan~West Lothian~West Midlands~West Sussex~West Yorkshire~Western Isles~Wiltshire~Wirral~Worcestershire~Wrexham~York"
	CountryStates["Germany"] 		= "Select State~BadenWurtemberg~Bavaria~Berlin~Brandenburg~Bremen~Hamburg~Hessen~Lower Saxony~Mecklenburg-West Pomerania~Niedersachsen~North Rhine-Westphalia~Rheinland-Pfalz~Saarland~Saxony~Saxony-Anhalt~Schleswig-Holstein~Thuringia"	
	CountryStates["Vietnam"]		= "Select State~Ho Chi Minh City~Hanoi~Others"		
	//document.submitForm.szCountryName.value = document.submitForm.nCountryRes.options[document.submitForm.nCountryRes.selectedIndex].text
	document.submitForm.szState.value = state
	if(IsValidCountry(countrycode))
	{
		var States, stateIndex
		States = CountryStates[country].split("~")

		stateIndex = 0;
		
		if (state != "") {
			for(i=0;i<States.length;i++) {
				if (States[i] == state) {
					stateIndex = i;					
				}										
			}
		}
		for(i=0;i<States.length;i++)
        {
			document.submitForm.szState.options[i].text = States[i];
			document.submitForm.szState.options[i].value = States[i];
        }
		for(j=140;j>=i;j--)
			document.submitForm.szState.options[j] = null			
		document.submitForm.szState.selectedIndex = stateIndex	
	}
	else
	   {
	   	document.submitForm.szState.options[0].text = "none"
		document.submitForm.szState.selectedIndex = 0
		for(j=140;j>=1;j--)
			document.submitForm.szState.options[j] = null
	   } 			
}


function IsValidCountry(CountryCode)
{	
	var i,MaxCounter
	var ValidCountries = ["1","20","27","30","31","32","33","34","36","40","41","43","44","46","45","47","48","49","61","62","63","64","66","81","82","84","86","90","91","92","94","107","230","351","358","359","353","420","852","880","960","966","971","972"]
	MaxCounter = ValidCountries.length
	for(i=0;i<MaxCounter;i++)
	 {
	   if (CountryCode == ValidCountries[i])
	        return true
	  }
	 return false    	 
}
