// Country/State Changer

function RefreshStates(country, statelookup, selectedState) {
statelookup.selectedIndex=0
if (country.options[country.selectedIndex].value=='US') //-- United States
   {
   statelookup.length           = 61
    statelookup.options[ 0].value="";	statelookup.options[ 0].text="Select a State"	
	statelookup.options[ 1].value="AL";	statelookup.options[ 1].text="Alabama"
	statelookup.options[ 2].value="AK";	statelookup.options[ 2].text="Alaska"
	statelookup.options[ 3].value="AS";	statelookup.options[ 3].text="American Samoa"
	statelookup.options[ 4].value="AZ";	statelookup.options[ 4].text="Arizona"
	statelookup.options[ 5].value="AR";	statelookup.options[ 5].text="Arkansas"
	statelookup.options[ 6].value="CA";	statelookup.options[ 6].text="California"
	statelookup.options[ 7].value="CO";	statelookup.options[ 7].text="Colorado"
	statelookup.options[ 8].value="CT";	statelookup.options[ 8].text="Connecticut"
	statelookup.options[ 9].value="DE";	statelookup.options[ 9].text="Delaware"
	statelookup.options[10].value="DC";	statelookup.options[10].text="District Of Columbia"
	statelookup.options[11].value="FM";	statelookup.options[11].text="Fed. States Of Micronesia"
	statelookup.options[12].value="FL";	statelookup.options[12].text="Florida"
	statelookup.options[13].value="GA";	statelookup.options[13].text="Georgia"
	statelookup.options[14].value="GU";	statelookup.options[14].text="Guam"
	statelookup.options[15].value="HI";	statelookup.options[15].text="Hawaii"
	statelookup.options[16].value="ID";	statelookup.options[16].text="Idaho"
	statelookup.options[17].value="IL";	statelookup.options[17].text="Illinois"
	statelookup.options[18].value="IN";	statelookup.options[18].text="Indiana"
	statelookup.options[19].value="IA";	statelookup.options[19].text="Iowa"
	statelookup.options[20].value="KS";	statelookup.options[20].text="Kansas"
	statelookup.options[21].value="KY";	statelookup.options[21].text="Kentucky"
	statelookup.options[22].value="LA";	statelookup.options[22].text="Louisiana"
	statelookup.options[23].value="ME";	statelookup.options[23].text="Maine"
	statelookup.options[24].value="MH";	statelookup.options[24].text="Marshall Islands"
	statelookup.options[25].value="MD";	statelookup.options[25].text="Maryland"
	statelookup.options[26].value="MA";	statelookup.options[26].text="Massachusetts"
	statelookup.options[27].value="MI";	statelookup.options[27].text="Michigan"
	statelookup.options[28].value="MN";	statelookup.options[28].text="Minnesota"
	statelookup.options[29].value="MS";	statelookup.options[29].text="Mississippi"
	statelookup.options[30].value="MO";	statelookup.options[30].text="Missouri"
	statelookup.options[31].value="MT";	statelookup.options[31].text="Montana"
	statelookup.options[32].value="NE";	statelookup.options[32].text="Nebraska"
	statelookup.options[33].value="NV";	statelookup.options[33].text="Nevada"
	statelookup.options[34].value="NH";	statelookup.options[34].text="New Hampshire"
	statelookup.options[35].value="NJ";	statelookup.options[35].text="New Jersey"
	statelookup.options[36].value="NM";	statelookup.options[36].text="New Mexico"
	statelookup.options[37].value="NY";	statelookup.options[37].text="New York"
	statelookup.options[38].value="NC";	statelookup.options[38].text="North Carolina"
	statelookup.options[39].value="ND";	statelookup.options[39].text="North Dakota"
	statelookup.options[40].value="MP";	statelookup.options[40].text="North. Mariana Islands"
	statelookup.options[41].value="OH";	statelookup.options[41].text="Ohio"
	statelookup.options[42].value="OK";	statelookup.options[42].text="Oklahoma"
	statelookup.options[43].value="OR";	statelookup.options[43].text="Oregon"
	statelookup.options[44].value="PW";	statelookup.options[44].text="Palau"
	statelookup.options[45].value="PA";	statelookup.options[45].text="Pennsylvania"
	statelookup.options[46].value="PR";	statelookup.options[46].text="Puerto Rico"
	statelookup.options[47].value="RI";	statelookup.options[47].text="Rhode Island"
	statelookup.options[48].value="SC";	statelookup.options[48].text="South Carolina"
	statelookup.options[49].value="SD";	statelookup.options[49].text="South Dakota"
	statelookup.options[50].value="TN";	statelookup.options[50].text="Tennessee"
	statelookup.options[51].value="TX";	statelookup.options[51].text="Texas"
	statelookup.options[52].value="TT";	statelookup.options[52].text="Trust Territories"
	statelookup.options[53].value="UT";	statelookup.options[53].text="Utah"
	statelookup.options[54].value="VT";	statelookup.options[54].text="Vermont"
	statelookup.options[55].value="VI";	statelookup.options[55].text="Virgin Islands"
	statelookup.options[56].value="VA";	statelookup.options[56].text="Virginia"
	statelookup.options[57].value="WA";	statelookup.options[57].text="Washington"
	statelookup.options[58].value="WV";	statelookup.options[58].text="West Virginia"
	statelookup.options[59].value="WI";	statelookup.options[59].text="Wisconsin"
	statelookup.options[60].value="WY";	statelookup.options[60].text="Wyoming"
    //document.getElementById('statelookup').disabled = true;
	}
else if (country.options[country.selectedIndex].value=='CA') //-- Canada
   { statelookup.length=15  
    statelookup.options[ 0].value="";	statelookup.options[ 0].text="Select a Province"
	statelookup.options[ 1].value="AB";	statelookup.options[ 1].text="Alberta"
	statelookup.options[ 2].value="BC";	statelookup.options[ 2].text="British Columbia"
	statelookup.options[ 3].value="MB";	statelookup.options[ 3].text="Manitoba"
	statelookup.options[ 4].value="NL";	statelookup.options[ 4].text="Labrador"	
	statelookup.options[ 5].value="NB";	statelookup.options[ 5].text="New Brunswick"
	statelookup.options[ 6].value="NF";	statelookup.options[ 6].text="Newfoundland"
	statelookup.options[ 7].value="NT";	statelookup.options[ 7].text="Northwest Territories"
	statelookup.options[ 8].value="NS";	statelookup.options[ 8].text="Nova Scotia"
	statelookup.options[ 9].value="NU";	statelookup.options[ 9].text="Nunavut"
	statelookup.options[10].value="ON";	statelookup.options[10].text="Ontario"
	statelookup.options[11].value="PE";	statelookup.options[11].text="Prince Edward Island"
	statelookup.options[12].value="QC";	statelookup.options[12].text="Quebec"
	statelookup.options[13].value="SK";	statelookup.options[13].text="Saskatchewan"
	statelookup.options[14].value="YT";	statelookup.options[14].text="Yukon Territory"
    //document.getElementById('statelookup').disabled = true;
	}
else if (country.options[country.selectedIndex].value=='UK') //-- UK - United Kingdom
   {statelookup.length=5  
    statelookup.options[ 0].value="";	statelookup.options[ 0].text="Select a Division"
	statelookup.options[ 1].value="EN";	statelookup.options[ 1].text="England"
	statelookup.options[ 2].value="SC";	statelookup.options[ 2].text="Scotland"
	statelookup.options[ 3].value="WA";	statelookup.options[ 3].text="Wales"
	statelookup.options[ 4].value="NI";	statelookup.options[ 4].text="Northern Ireland"
    //document.getElementById('statelookup').disabled = true;
   }
else if (country.options[country.selectedIndex].value=='AU') //-- AU - Australlia
   {statelookup.length=9  
    statelookup.options[ 0].value="";	statelookup.options[ 0].text="Select a State/Territory"
	statelookup.options[ 1].value="ACT";	statelookup.options[ 1].text="Australian Capital Territory"
	statelookup.options[ 2].value="NSW";	statelookup.options[ 2].text="New South Wales"
	statelookup.options[ 3].value="NT";	statelookup.options[ 3].text="Northern Territory"
	statelookup.options[ 4].value="QLD";	statelookup.options[ 4].text="Queensland" 
	statelookup.options[ 5].value="SA";	statelookup.options[ 5].text="South Australia"
	statelookup.options[ 6].value="TAS";	statelookup.options[ 6].text="Tasmania"
	statelookup.options[ 7].value="VIC";	statelookup.options[ 7].text="Victoria"
	statelookup.options[ 8].value="WA";	statelookup.options[ 8].text="Western Australia"
    //document.getElementById('statelookup').disabled = true;
   }
else if (country.options[country.selectedIndex].value=='DK') //-- DK - Denmark
	{statelookup.length=6  
	statelookup.options[ 0].value="";	  statelookup.options[ 0].text="Select a Region"
	statelookup.options[ 1].value="DK-84";	statelookup.options[ 1].text="Hovedstaden"
	statelookup.options[ 2].value="DK-82";	statelookup.options[ 2].text="Midtjylland"
	statelookup.options[ 3].value="DK-81";	statelookup.options[ 3].text="Nordjylland"
	statelookup.options[ 4].value="DK-85";	statelookup.options[ 4].text="Sjaelland"
	statelookup.options[ 5].value="DK-83";	statelookup.options[ 5].text="Syddanmark"
	}
else if (country.options[country.selectedIndex].value=='NO') //-- NO - Norway
	{statelookup.length=21  
	statelookup.options[ 0].value="";	  statelookup.options[ 0].text="Select a Subdivision"
	statelookup.options[ 1].value="NO-02";	statelookup.options[ 1].text="Akershus"
	statelookup.options[ 2].value="NO-09";	statelookup.options[ 2].text="Aust-Agder"
	statelookup.options[ 3].value="NO-06";	statelookup.options[ 3].text="Buskerud"
	statelookup.options[ 4].value="NO-20";	statelookup.options[ 4].text="Finnmark"
	statelookup.options[ 5].value="NO-04";	statelookup.options[ 5].text="Hedmark"
	statelookup.options[ 6].value="NO-12";	statelookup.options[ 6].text="Hordaland"
	statelookup.options[ 7].value="NO-15";	statelookup.options[ 7].text="More og Romsdal"
	statelookup.options[ 8].value="NO-18";	statelookup.options[ 8].text="Nordland"
	statelookup.options[ 9].value="NO-17";	statelookup.options[ 9].text="Nord-Trondelag"
	statelookup.options[ 10].value="NO-05";	statelookup.options[ 10].text="Oppland"
	statelookup.options[ 11].value="NO-11";	statelookup.options[ 11].text="Rogaland"
	statelookup.options[ 12].value="NO-14";	statelookup.options[ 12].text="Sogn og Fjordane"
	statelookup.options[ 13].value="NO-16";	statelookup.options[ 13].text="Sor-Trondelag"
	statelookup.options[ 14].value="NO-08";	statelookup.options[ 14].text="Telemark"
	statelookup.options[ 15].value="NO-19";	statelookup.options[ 15].text="Troms"
	statelookup.options[ 16].value="NO-10";	statelookup.options[ 16].text="Vest-Agder"
	statelookup.options[ 17].value="NO-07";	statelookup.options[ 17].text="Vestfold"
	statelookup.options[ 18].value="NO-01";	statelookup.options[ 18].text="Ostfold"
	statelookup.options[ 19].value="NO-22";	statelookup.options[ 19].text="Jan Mayen"
	statelookup.options[ 20].value="NO-21";	statelookup.options[ 20].text="Svalbard"
	}
else if (country.options[country.selectedIndex].value=='SE') //-- SE - Sweden
	{statelookup.length=22  
	statelookup.options[ 0].value="";	  statelookup.options[ 0].text="Select a Subdivision"
	statelookup.options[ 1].value="SE-K";	statelookup.options[ 1].text="Blekinge lan"
	statelookup.options[ 2].value="SE-W";	statelookup.options[ 2].text="Dalarnas lan"
	statelookup.options[ 3].value="SE-I";	statelookup.options[ 3].text="Gotlands lan"
	statelookup.options[ 4].value="SE-X";	statelookup.options[ 4].text="Gavleborgs lan"
	statelookup.options[ 5].value="SE-N";	statelookup.options[ 5].text="Hallands lan"
	statelookup.options[ 6].value="SE-Z";	statelookup.options[ 6].text="Jamtlands lan"
	statelookup.options[ 7].value="SE-F";	statelookup.options[ 7].text="Jonkopings lan"
	statelookup.options[ 8].value="SE-H";	statelookup.options[ 8].text="Kalmar lan"
	statelookup.options[ 9].value="SE-G";	statelookup.options[ 9].text="Kronobergs lan"
	statelookup.options[ 10].value="SE-BD";	statelookup.options[ 10].text="Norrbottens lan"
	statelookup.options[ 11].value="SE-M";	statelookup.options[ 11].text="Skane lan"
	statelookup.options[ 12].value="SE-AB";	statelookup.options[ 12].text="Stockholms lan"
	statelookup.options[ 13].value="SE-D";	statelookup.options[ 13].text="Sodermanlands lan"
	statelookup.options[ 14].value="SE-C";	statelookup.options[ 14].text="Uppsala lan"
	statelookup.options[ 15].value="SE-S";	statelookup.options[ 15].text="Varmlands lan"
	statelookup.options[ 16].value="SE-AC";	statelookup.options[ 16].text="Vasterbottens lan"
	statelookup.options[ 17].value="SE-Y";	statelookup.options[ 17].text="Vasternorrlands lan"
	statelookup.options[ 18].value="SE-U";	statelookup.options[ 18].text="Vastmanlands lan"
	statelookup.options[ 19].value="SE-O";	statelookup.options[ 19].text="Vastra Gotalands lan"
	statelookup.options[ 20].value="SE-T";	statelookup.options[ 20].text="Orebro lan"
	statelookup.options[ 21].value="SE-E";	statelookup.options[ 21].text="Ostergotlands lan"
	}
else if (country.options[country.selectedIndex].value=='NZ') //-- NZ - New Zealand
   {statelookup.length=17  
    statelookup.options[ 0].value="";	  statelookup.options[ 0].text="Select a Province"
	statelookup.options[ 1].value="AUK";	statelookup.options[ 1].text="Auckland"
	statelookup.options[ 2].value="BOP";	statelookup.options[ 2].text="Bay of Plenty"
	statelookup.options[ 3].value="CAN";	statelookup.options[ 3].text="Canterbury"
	statelookup.options[ 4].value="GIS";	statelookup.options[ 4].text="Gisborne" 
	statelookup.options[ 5].value="HKB";	statelookup.options[ 5].text="Hawke's Bay"
	statelookup.options[ 6].value="MBH";	statelookup.options[ 6].text="Marlborough"
	statelookup.options[ 7].value="MWT";	statelookup.options[ 7].text="Manawatu-Wanganui"
	statelookup.options[ 8].value="NSN";	statelookup.options[ 8].text="Nelson"
	statelookup.options[ 9].value="NTL";	statelookup.options[ 9].text="Northland"
	statelookup.options[ 10].value="OTA";	statelookup.options[ 10].text="Otago"
	statelookup.options[ 11].value="STL";	statelookup.options[ 11].text="Southland"
	statelookup.options[ 12].value="TAS";	statelookup.options[ 12].text="Tasman"
	statelookup.options[ 13].value="TKI";	statelookup.options[ 13].text="Taranaki"
	statelookup.options[ 14].value="WGN";	statelookup.options[ 14].text="Wellington"
	statelookup.options[ 15].value="WKO";	statelookup.options[ 15].text="Waikato"
	statelookup.options[ 16].value="WTC";	statelookup.options[ 16].text="West Coast"
    //document.getElementById('state').disabled = true;
   }

else if (country.options[country.selectedIndex].value=='CL') //-- CL
{statelookup.length=14  
statelookup.options[ 0].value="";	  statelookup.options[ 0].text="Select a Region"
	statelookup.options[ 1].value="CL-AI"; statelookup.options[ 1].text="Aisen del General Carlos Ibanez del Campo"
	statelookup.options[ 2].value="CL-AN"; statelookup.options[ 2].text="Antofagasta"
	statelookup.options[ 3].value="CL-AR"; statelookup.options[ 3].text="Araucania"
	statelookup.options[ 4].value="CL-AT"; statelookup.options[ 4].text="Atacama"
	statelookup.options[ 5].value="CL-BI"; statelookup.options[ 5].text="Bio-Bio"
	statelookup.options[ 6].value="CL-CO"; statelookup.options[ 6].text="Coquimbo"
	statelookup.options[ 7].value="CL-LI"; statelookup.options[ 7].text="Libertador General Bernardo O'Higgins"
	statelookup.options[ 8].value="CL-LL"; statelookup.options[ 8].text="Los Lagos"
	statelookup.options[ 9].value="CL-MA"; statelookup.options[ 9].text="Magallanes"
	statelookup.options[ 10].value="CL-ML"; statelookup.options[ 10].text="Maule"
	statelookup.options[ 11].value="CL-RM"; statelookup.options[ 11].text="Region Metropolitana de Santiago"
	statelookup.options[ 12].value="CL-TA"; statelookup.options[ 12].text="Tarapaca"
	statelookup.options[ 13].value="CL-VS"; statelookup.options[ 13].text="Valparaiso"
 //document.getElementById('state').disabled = true;
}

else if (country.options[country.selectedIndex].value=='ZA') //-- ZA - South Africa
{statelookup.length=10  
 statelookup.options[ 0].value="";	  statelookup.options[ 0].text="Select a Province"
	statelookup.options[ 1].value="EC";	statelookup.options[ 1].text="Eastern Cape"
	statelookup.options[ 2].value="FS";	statelookup.options[ 2].text="Free State"
	statelookup.options[ 3].value="GP";	statelookup.options[ 3].text="Gauteng"
	statelookup.options[ 4].value="KZ";	statelookup.options[ 4].text="KwaZulu-Natal" 
	statelookup.options[ 5].value="LP";	statelookup.options[ 5].text="Limpopo"
	statelookup.options[ 6].value="MP";	statelookup.options[ 6].text="Mpumalanga"
	statelookup.options[ 7].value="NC";	statelookup.options[ 7].text="Northern Cape"
	statelookup.options[ 8].value="NW";	statelookup.options[ 8].text="North West"
	statelookup.options[ 9].value="WC";	statelookup.options[ 9].text="Western Cape"
}
else if (country.options[country.selectedIndex].value=='IE') //-- IE - Ireland
{statelookup.length=5  
 statelookup.options[ 0].value="";	  statelookup.options[ 0].text="Select a Province"
	statelookup.options[ 1].value="C";	statelookup.options[ 1].text="Connaught"
	statelookup.options[ 2].value="L";	statelookup.options[ 2].text="Leinster"
	statelookup.options[ 3].value="M";	statelookup.options[ 3].text="Munster"
	statelookup.options[ 4].value="U";	statelookup.options[ 4].text="Ulster" 
}
else if (country.options[country.selectedIndex].value=='PL') //-- PL - Poland
{statelookup.length=17  
	statelookup.options[ 0].value="";	  statelookup.options[ 0].text="Select a Province"
	statelookup.options[ 1].value="DS";	statelookup.options[ 1].text="Lower Silesian"
	statelookup.options[ 2].value="KP";	statelookup.options[ 2].text="Kuyavian-Pomeranium"
	statelookup.options[ 3].value="LU";	statelookup.options[ 3].text="Lublin"
	statelookup.options[ 4].value="LB";	statelookup.options[ 4].text="Lubusz" 
	statelookup.options[ 5].value="LD";	statelookup.options[ 5].text="Lodz"
	statelookup.options[ 6].value="MP";	statelookup.options[ 6].text="Lesser Poland"
	statelookup.options[ 7].value="MA";	statelookup.options[ 7].text="Masovian"
	statelookup.options[ 8].value="OP";	statelookup.options[ 8].text="Opole"
	statelookup.options[ 9].value="PK";	statelookup.options[ 9].text="Subcarpathian"
	statelookup.options[10].value="PD";	statelookup.options[10].text="Podlaskie"
	statelookup.options[11].value="PM";	statelookup.options[11].text="Pomeranian"
	statelookup.options[12].value="SL";	statelookup.options[12].text="Silesian"
	statelookup.options[13].value="SW";	statelookup.options[13].text="Swietokrzyskie"
	statelookup.options[14].value="WM";	statelookup.options[14].text="Warmian-Masurian"
	statelookup.options[15].value="WP";	statelookup.options[15].text="Greater Poland"
	statelookup.options[16].value="ZP";	statelookup.options[16].text="West Pomeranian"
}
else if (country.options[country.selectedIndex].value=='IN') //-- IN - India
{statelookup.length=29  
	statelookup.options[ 0].value="";	  statelookup.options[ 0].text="Select a State"
	statelookup.options[ 1].value="AP";	statelookup.options[ 1].text="Andhra Pradesh"
	statelookup.options[ 2].value="AR";	statelookup.options[ 2].text="Arunachal Pradesh"
	statelookup.options[ 3].value="AS";	statelookup.options[ 3].text="Assam"
	statelookup.options[ 4].value="BR";	statelookup.options[ 4].text="Bihar" 
	statelookup.options[ 5].value="CG";	statelookup.options[ 5].text="Chhattisgarh"
	statelookup.options[ 6].value="GA";	statelookup.options[ 6].text="Goa"
	statelookup.options[ 7].value="GJ";	statelookup.options[ 7].text="Gujarat"
	statelookup.options[ 8].value="HP";	statelookup.options[ 8].text="Himachal Pradesh"
	statelookup.options[ 9].value="HR";	statelookup.options[ 9].text="Haryana"
	statelookup.options[10].value="JH";	statelookup.options[10].text="Jharkhand"
	statelookup.options[11].value="JK";	statelookup.options[11].text="Jammu and Kashmir"
	statelookup.options[12].value="KA";	statelookup.options[12].text="Karnataka"
	statelookup.options[13].value="KL";	statelookup.options[13].text="Kerala"
	statelookup.options[14].value="MH";	statelookup.options[14].text="Maharashtra"
	statelookup.options[15].value="ML";	statelookup.options[15].text="Meghalaya"
	statelookup.options[16].value="MN";	statelookup.options[16].text="Manipur"
	statelookup.options[17].value="MP";	statelookup.options[17].text="Madhya Pradesh"
	statelookup.options[18].value="MZ";	statelookup.options[18].text="Mizoram"
	statelookup.options[19].value="NL";	statelookup.options[19].text="Nagaland"
	statelookup.options[20].value="OR";	statelookup.options[20].text="Orissa"
	statelookup.options[21].value="PB";	statelookup.options[21].text="Punjab"
	statelookup.options[22].value="RJ";	statelookup.options[22].text="Rajasthan"
	statelookup.options[23].value="SK";	statelookup.options[23].text="Sikkim"
	statelookup.options[24].value="TN";	statelookup.options[24].text="Tamil Nadu"
	statelookup.options[25].value="TR";	statelookup.options[25].text="Tripura"
	statelookup.options[26].value="UL";	statelookup.options[26].text="Uttarakhand"
	statelookup.options[27].value="UP";	statelookup.options[27].text="Uttar Pradesh"
	statelookup.options[28].value="WB";	statelookup.options[28].text="West Bengal"
}
else if (country.options[country.selectedIndex].value=="SG") // -- SG -- Singapore
{statelookup.length=1
	statelookup.options[ 0].value="SG";	statelookup.options[ 0].text="Singapore"
}
else if (country.options[country.selectedIndex].value=='OTHER') //-- Other
   {statelookup.length=1  
    statelookup.options[ 0].value="";	statelookup.options[ 0].text="Please Enter Below" 
    document.getElementById('statelookup').value="";
    //document.getElementById('statelookup').disabled = false;
   }
else	
    {	
	statelookup.length=1;
	statelookup.options[ 0].value="";	statelookup.options[ 0].text="Please Enter Below"
    //document.getElementById(statelookup).value="";
		statelookup.disabled = false; 
    }

  //Sets value on Return
	if(selectedState!=''){
		  var is_array = selectedState.split(",");
	  for (var i=0; i<statelookup.options.length; i++){
	      for (var loop=0; loop<is_array.length; loop++){//Loops through array if found for multi select drop downs
		         if (statelookup.options[i].value==is_array[loop]){
		            statelookup.options[i].selected = true;
		          }
	
	      } 
	    }
	  }
    
}


