function loadCountyDropdown(selected)
{
//iterate through nodes, find where matches "selected"
	//iterate states, get a match

//alert(the_states.length)

for(var i = 0; i < the_states.length; i++)	{
	//match NAME attribute against selected
	stateName = the_states[i].getAttribute("NAME")
	if(stateName == selected)
	{
		the_counties = the_states[i].getElementsByTagName("county")
		if(the_counties)
		{
			//htmlString = "<select name=\"County\" class=\"textbox\" id=\"County\" onblur=\"design_validate_select(1, this, 'First item is not a valid selection.')\" title=\"County\" style=\"WIDTH: 142px\" name=\"County\" ektdesignns_name=\"County\" ektdesignns_caption=\"County\" ektdesignns_nodetype=\"element\" ektdesignns_validation=\"select-req\">\n"
			
            document.aspnetForm.County.options.length=0
			//add blank line
			document.aspnetForm.County.options[0]=new Option("Select County", "", true, false)
			//htmlString += "<option>Select County</option>\n"

			for(var a = 0; a < the_counties.length; a++)
			{
			
			    document.aspnetForm.County.options[a+1]=new Option(the_counties[a].firstChild.nodeValue, the_counties[a].firstChild.nodeValue, true, false)
	//		    htmlString += "<option>" + the_counties[a].firstChild.nodeValue + "</option>\n"
			}
		//	htmlString += "</select>"

						//document.getElementById("county_dropdown").innerHTML = htmlString
					}
		}
	}
}

function loadCounties(){
	var Request = new 
	Ajax.Request('/assets/xml/counties.xml', {

		method: 'get',
		contentType: 'text/xml',

		onComplete: function(transport) {
		if(transport.status == 200)
		{
			the_states = transport.responseXML.getElementsByTagName("STATE")			}
		}
	})

}

function updateCounties(selected){
	loadCountyDropdown(selected)
}