function GetStates(countryId){
	var response = UniversalTennis.FrontEnd.Controls.CountryState.GetStates(countryId, "Abbreviation");
	if(response.error != null){
		return null;
	}
	else{
		return response.value;
	}
}
function AddStates(selStates, hidStateList, countryId, selectedValue){
	ClearDropDown(selStates);
	var aryStates = GetStates(countryId);
	var strStates = "";
	if(aryStates != null && aryStates.length > 1){
		var selectedIndex = 0;
		for(var i=0; i < aryStates.length; i++){
			AddElement(selStates, aryStates[i].Value, aryStates[i].Text);
			
			strStates += aryStates[i].Value + "|" + aryStates[i].Text;
			
			//if a selected value was passed, try to find it and set it	
			if(selectedValue && selectedValue == aryStates[i].Value){
				selectedIndex = i;
				strStates += "|selected";
			}
			
			strStates += ",";
		}
		if(strStates.length > 0){
			strStates = strStates.substr(0,strStates.length -1);
		}
		hidStateList.value = strStates;	
		
		selStates.selectedIndex = selectedIndex;
		
		selStates.style.display = 'inline';
	}
	else{
		selStates.style.display = 'none';
		hidStateList.value = "";
	}
}
