function LoadState(statetype,selectedstate)
{
var selectedcountry;
if(statetype == 1)
selectedcountry=document.custform.country.value;
if(statetype == 2)
selectedcountry=document.custform.scountry.value;
if(statetype == 3)
selectedcountry=document.custform.bcountry.value;

//alert(selectedcountry);
if(selectedcountry == "")
selectedcountry=4;

if(selectedcountry != 4)
{
	if(statetype == 1)
	{
	var showblock=document.getElementById("showstatetext");	
	var notshowblock=document.getElementById("showstatelist");	

	}
	if(statetype == 2)
	{
	var showblock=document.getElementById("showsstatetext");	
	var notshowblock=document.getElementById("showsstatelist");	
	}
	if(statetype == 3)
	{
	var showblock=document.getElementById("showbstatetext");	
	var notshowblock=document.getElementById("showbstatelist");	
	}
	showblock.style.display = "block";
notshowblock.style.display = "none";
return;
}
else
{
	if(statetype == 1)
	{
	var notshowblock=document.getElementById("showstatetext");	
	var showblock=document.getElementById("showstatelist");	
	document.custform.state.value="";
	}
	if(statetype == 2)
	{
	var notshowblock=document.getElementById("showsstatetext");	
	var showblock=document.getElementById("showsstatelist");	
	document.custform.sstate.value="";
	}
	if(statetype == 3)
	{
	var notshowblock=document.getElementById("showbstatetext");	
	var showblock=document.getElementById("showbstatelist");	
	document.custform.bstate.value="";
	}
	showblock.style.display = "block";
	notshowblock.style.display = "none";
}

country=new Array("4");

state = new Array();

state[0] = "0^1^ALABAMA^1";
state[1] = "0^2^ALASKA^2";
state[2] = "0^3^AMERICAN SAMOA^3";
state[3] = "0^4^ARIZONA^4";
state[4] = "0^5^ARKANSAS^5";
state[5] = "0^6^Armed Forces Africa^60";
state[6] = "0^7^Armed Forces Americas(except Canada)^61";
state[7] = "0^8^Armed Forces Canada^62";
state[8] = "0^9^Armed Forces Europe^63";
state[9] = "0^10^Armed Forces Middle East^64";
state[10] = "0^11^Armed Forces Pacific^65";
state[11] = "0^12^CALIFORNIA^6";
state[12] = "0^13^COLORADO^7";
state[13] = "0^14^CONNECTICUT^8";
state[14] = "0^15^DELAWARE^9";
state[15] = "0^16^DISTRICT OF COLUMBIA^10";
state[16] = "0^17^FEDERATED STATES OF MICRONESIA^11";
state[17] = "0^18^FLORIDA^12";
state[18] = "0^19^GEORGIA^13";
state[19] = "0^20^GUAM^14";
state[20] = "0^21^HAWAIIHI^15";
state[21] = "0^22^IDAHO^16";
state[22] = "0^23^ILLINOIS^17";
state[23] = "0^24^INDIANA^18";
state[24] = "0^25^IOWA^19";
state[25] = "0^26^KANSAS^20";
state[26] = "0^27^KENTUCKY^21";
state[27] = "0^28^LOUISIANA^22";
state[28] = "0^29^MAINE^23";
state[29] = "0^30^MARSHALL ISLANDS^24";
state[30] = "0^31^MARYLAND^25";
state[31] = "0^32^MASSACHUSETTS^26";
state[32] = "0^33^MICHIGAN^27";
state[33] = "0^34^MINNESOTA^28";
state[34] = "0^35^MISSISSIPPI^29";
state[35] = "0^36^MISSOURI^30";
state[36] = "0^37^MONTANA^31";
state[37] = "0^38^NEBRASKA^32";
state[38] = "0^39^NEVADA^33";
state[39] = "0^40^NEW HAMPSHIRE^34";
state[40] = "0^41^NEW JERSEY^35";
state[41] = "0^42^NEW MEXICO^36";
state[42] = "0^43^NEW YORK^37";
state[43] = "0^44^NORTH CAROLINA^38";
state[44] = "0^45^NORTH DAKOTA^39";
state[45] = "0^46^NORTHERN MARIANA ISLANDS^40";
state[46] = "0^47^OHIO^41";
state[47] = "0^48^OKLAHOMA^42";
state[48] = "0^49^OREGON^43";
state[49] = "0^50^PALAU^44";
state[50] = "0^51^PENNSYLVANIA^45";
state[51] = "0^52^PUERTO RICO^46";
state[52] = "0^53^RHODE ISLAND^47";
state[53] = "0^54^SOUTH CAROLINA^48";
state[54] = "0^55^SOUTH DAKOTA^49";
state[55] = "0^56^TENNESSEE^50";
state[56] = "0^57^TEXAS^51";
state[57] = "0^58^UTAH^52";
state[58] = "0^59^VERMONT^53";
state[59] = "0^60^VIRGIN ISLANDS^54";
state[60] = "0^61^VIRGINIA^55";
state[61] = "0^62^WASHINGTON^56";
state[62] = "0^63^WEST VIRGINIA^57";
state[63] = "0^64^WISCONSIN^58";
state[64] = "0^65^WYOMING^59";

var intvalue;
for (var i=0;i<country.length;i++)	
	{
		if(selectedcountry == country[i])
		intvalue=i;
		
	}	

 
for (var i=0;i<state.length;i++)	
	{
		arrtemp=new Array();
		arrtemp=state[i].split("^");		

		if (intvalue == arrtemp[0])	
		{
			
			if(statetype == 1)
			{
			
			document.custform.statelist.options.length += 1;	
			
			var k = document.custform.statelist.options.length;
			document.custform.statelist.options[k-1].value = arrtemp[3];			document.custform.statelist.options[k-1].text = arrtemp[2];
			if(selectedstate == arrtemp[3])
			document.custform.statelist.options[k-1].selected=true;
			
			}
			if(statetype == 2)
			{
			document.custform.sstatelist.options.length += 1;				
			var k = document.custform.sstatelist.options.length;
			
			document.custform.sstatelist.options[k-1].value = arrtemp[3];			document.custform.sstatelist.options[k-1].text = arrtemp[2];	
			if(selectedstate == arrtemp[3])
			document.custform.sstatelist.options[k-1].selected=true;
			}
			if(statetype == 3)
			{
			document.custform.bstatelist.options.length += 1;				
			var k = document.custform.bstatelist.options.length;
			
			document.custform.bstatelist.options[k-1].value = arrtemp[3];			document.custform.bstatelist.options[k-1].text = arrtemp[2];
			if(selectedstate == arrtemp[3])
			document.custform.bstatelist.options[k-1].selected=true;
			}
			
		}

	}



}