
function fillCategory(){ 
 // this function is used to fill the category list on load

addOption(document.frm.Category, "USA", "USA", "");
addOption(document.frm.Category, "Canada", "Canada", "");
}
function SelectSubCat(){
//alert(document.frm.Category.value);
// ON selection of category this function will work
removeAllOptions(document.frm.SubCat);
addOption(document.frm.SubCat, "", "Select State", "");
	if(document.frm.Category.value == 'USA')
	{
		addOption(document.frm.SubCat,"AL", "Alabama");
		addOption(document.frm.SubCat,"AK", "Alaska");
		addOption(document.frm.SubCat,"AZ", "Arizona");
		addOption(document.frm.SubCat,"AR", "Arkansas");
		addOption(document.frm.SubCat,"CA", "California");
		addOption(document.frm.SubCat,"CO", "Colorado");
		addOption(document.frm.SubCat,"CT", "Connecticut");
		addOption(document.frm.SubCat,"DE", "Delaware");
		addOption(document.frm.SubCat,"DC", "District of Columbia");
		addOption(document.frm.SubCat,"FL", "Florida");
		addOption(document.frm.SubCat,"GA", "Georgia");
		addOption(document.frm.SubCat,"HI", "Hawaii");
		addOption(document.frm.SubCat,"ID", "Idaho");
		addOption(document.frm.SubCat,"IL", "Illinois");
		addOption(document.frm.SubCat,"IN", "Indiana");
		addOption(document.frm.SubCat,"IA", "Iowa");
		addOption(document.frm.SubCat,"KS", "Kansas");
		addOption(document.frm.SubCat,"KY", "Kentucky");
		addOption(document.frm.SubCat,"LA", "Louisiana");
		addOption(document.frm.SubCat,"ME", "Maine");
		addOption(document.frm.SubCat,"MD", "Maryland");
		addOption(document.frm.SubCat,"MA", "Massachusetts");
		addOption(document.frm.SubCat,"MI", "Michigan");
		addOption(document.frm.SubCat,"MN", "Minnesota");
		addOption(document.frm.SubCat,"MS", "Mississippi");
		addOption(document.frm.SubCat,"MO", "Missouri");
		addOption(document.frm.SubCat,"MT", "Montana");
		addOption(document.frm.SubCat,"NE", "Nebraska");
		addOption(document.frm.SubCat,"NV", "Nevada");
		addOption(document.frm.SubCat,"NH", "New Hampshire");
		addOption(document.frm.SubCat,"NJ", "New Jersey");
		addOption(document.frm.SubCat,"NM", "New Mexico");
		addOption(document.frm.SubCat,"NY", "New York");
		addOption(document.frm.SubCat,"NC", "North Carolina");
		addOption(document.frm.SubCat,"ND", "North Dakota");
		addOption(document.frm.SubCat,"OH", "Ohio");
		addOption(document.frm.SubCat,"OK", "Oklahoma");
		addOption(document.frm.SubCat,"OR", "Oregon");
		addOption(document.frm.SubCat,"PA", "Pennsylvania");
		addOption(document.frm.SubCat,"RI", "Rhode Island");
		addOption(document.frm.SubCat,"SC", "South Carolina");
		addOption(document.frm.SubCat,"SD", "South Dakota");
		addOption(document.frm.SubCat,"TN", "Tennessee");
		addOption(document.frm.SubCat,"TX", "Texas");
		addOption(document.frm.SubCat,"UT", "Utah");
		addOption(document.frm.SubCat,"VT", "Vermont");
		addOption(document.frm.SubCat,"VA", "Virginia");
		addOption(document.frm.SubCat,"WA", "Washington");
		addOption(document.frm.SubCat,"WV", "West Virginia");
		addOption(document.frm.SubCat,"WI", "Wisconsin");
		addOption(document.frm.SubCat,"WY", "Wyoming");
		

	}
	if(document.frm.Category.value == 'Canada')
	{
		addOption(document.frm.SubCat,"AB", "Alberta");
		addOption(document.frm.SubCat,"BC", "British Columbia");
		addOption(document.frm.SubCat,"MB", "Manitoba");
		addOption(document.frm.SubCat,"NB", "New Brunswick");
		addOption(document.frm.SubCat,"NL", "Newfoundland and Lab");
		addOption(document.frm.SubCat,"NT", "Northwest Territorie");
		addOption(document.frm.SubCat,"NS", "Nova Scotia");
		addOption(document.frm.SubCat,"NU", "Nunavut");
		addOption(document.frm.SubCat,"ON", "Ontario");
		addOption(document.frm.SubCat,"PE", "Prince Edward Island");
		addOption(document.frm.SubCat,"QC", "Québec");
		addOption(document.frm.SubCat,"SK", "Saskatchewan");
		addOption(document.frm.SubCat,"YT", "Yukon Territory");

	}
	}

function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		//selectbox.options.remove(i);
		selectbox.remove(i);
	}
}


function addOption(selectbox, value, text )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;

	selectbox.options.add(optn);
}
