function getData()
{
	var format = getRadioValue(document.surveyform.format);
	var surveyselect = document.surveyform.surveyselect;
	var county = surveyselect.selectedIndex >= 0 ? surveyselect.options[surveyselect.selectedIndex].text : null;
	var state = county != null ? county.substring(0, 2) : null;
	var thunderType = document.surveyform.type.options[document.surveyform.type.selectedIndex].value;
	var PDF_error_flag = false;
	if (county == "Clickable Missouri Map")
	{
		window.location.href = "http://www.soilsurvey.org/surveys/stateMAPU.asp";
	}
	else if (format == "HTML" && state == "MO") // HTML Manuscripts for Missouri only
	{
		window.location.href = "manuscript.asp?series=" + county.substring(0, 5);
	}
	else if (format == "Thunder" && county != null) // Thundersheets, same naming convention for both states
	{
		if (thunderType == "LGD")
		{
			window.location.href = "legend.asp?county=" + county;
		}
		else if (thunderType == "STD")
		{
			window.location.href = "thunder.asp?county=" + county;
		}
		else
		{
			window.location.href = "thundernow.asp?county=" + county + "&type=" + thunderType;
		}
	}
	else if (format == "PDF")
	{
		if (state == "MO") // for Missouri the county name is used without spaces or periods
		{
			window.location.href = "pdf.asp?county=" + county.substring(8, county.indexOf("County") - 1).replace(" ", "").replace(".", "");
		}
		else if (state == "TX") // for Texas the browser is pointed to the generic Texas page at soils.usda.gov (read: the browser could be pointed directly to the correct pdf but not every county is listed)
		{
			window.location.href = "http://soils.usda.gov/survey/online_surveys/texas/";
		}
		else
		{
			PDF_error_flag = true;
		}
	}
	else if (format == "SSURGO") // Soils GIS Data, same naming convention for both states (read: the UseState parameter is not currently avaliable from the Soil Data Mart for "TX" but is included anyway)
	{
		window.location.href = "http://soildatamart.nrcs.usda.gov/Download.aspx?Survey=" + county.substring(0, 5) + "&UseState=" + state;
	}

	// catch if the user didn't enter a county or choose a format
	if (county == null)
	{
		document.getElementById("noCounty").innerHTML = "no county choosen";
	}
	else
	{
		document.getElementById("noCounty").innerHTML = "";
	}
	if (format == null)
	{
		document.getElementById("noFormat").innerHTML = "no format selected";
	}
	else if (PDF_error_flag)
	{
		document.getElementById("noFormat").innerHTML = "PDFs are not yet avaliable for your state";
	}
	else
	{
		document.getElementById("noFormat").innerHTML = "";
	}
}

function getRadioValue(name) // from http://www.soilsurvey.org/js/go_pdf.js, used to get the name of the selected radio button
{
	var value = null;
	
	if (name.length)
	{
		for (var i = 0; i < name.length; i++)
		{
			if (name[i].checked) value = name[i].value;
		}
	}
	else if (name.checked) value = name.value;

	return value;
}