//This function removes all options from a listbox
function removeAll(listbox)
{
var i;
for(i=listbox.options.length-1;i>=0;i--)
{
listbox.remove(i);
}
}

//This function adds an option to a listbox
function addOption(listbox,text,value)
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
listbox.options.add(optn);
}

//This function removes all options from the city listboxand then populates each one based on the state selection
function seeSelected(){
if (document.theform.VA.checked)
	{
	document.theform.state.value = "VA";
	removeAll(document.theform.city);
	addOption(document.theform.city, "All VA Cities","");
	addOption(document.theform.city, "Accomack","Accomack");
	addOption(document.theform.city, "Caroline","Caroline");
	addOption(document.theform.city, "Chesapeake","Chesapeake");
	addOption(document.theform.city, "Culpeper","Culpeper");
	addOption(document.theform.city, "Emporia","Emporia");
	addOption(document.theform.city, "Franklin","Franklin");
	addOption(document.theform.city, "Fredericksburg City","Fredericksburg City");
	addOption(document.theform.city, "Gloucester","Gloucester");
	addOption(document.theform.city, "Hampton","Hampton");
	addOption(document.theform.city, "Isle Of Wight","Isle Of Wight");
	addOption(document.theform.city, "James City","James City");
	addOption(document.theform.city, "King George","King George");
	addOption(document.theform.city, "Mathews","Mathews");
	addOption(document.theform.city, "Middlesex","Middlesex");
	addOption(document.theform.city, "Newport News","Newport News");
	addOption(document.theform.city, "Norfolk","Norfolk");
	addOption(document.theform.city, "Northampton","Northampton");
	addOption(document.theform.city, "Orange","Orange");
	addOption(document.theform.city, "Other","Other");
	addOption(document.theform.city, "Poquoson","Poquoson");
	addOption(document.theform.city, "Portsmouth","Portsmouth");
	addOption(document.theform.city, "Smithfield","Smithfield");
	addOption(document.theform.city, "Southampton","Southampton");
	addOption(document.theform.city, "Spotsylvania","Spotsylvania");
	addOption(document.theform.city, "Stafford","Stafford");
	addOption(document.theform.city, "Suffolk","Suffolk");
	addOption(document.theform.city, "Surry","Surry");
	addOption(document.theform.city, "Sussex","Sussex");
	addOption(document.theform.city, "Toano","Toano");
	addOption(document.theform.city, "Virginia Beach","Virginia Beach");
	addOption(document.theform.city, "Williamsburg","Williamsburg");
	addOption(document.theform.city, "Wmsburg","Wmsburg");
	addOption(document.theform.city, "York","York");
	}
if (document.theform.NC.checked)
	{
	document.theform.state.value = "NC";
	removeAll(document.theform.city);
	addOption(document.theform.city, "All NC Cities","");
	addOption(document.theform.city, "Bertie","Bertie");
	addOption(document.theform.city, "Camden","Camden");
	addOption(document.theform.city, "Chowan","Chowan");
	addOption(document.theform.city, "Currituck","Currituck");
	addOption(document.theform.city, "Dare","Dare");
	addOption(document.theform.city, "Gates","Gates");
	addOption(document.theform.city, "Hertford","Hertford");
	addOption(document.theform.city, "Moyock","Moyock");
	addOption(document.theform.city, "Pasquotank","Pasquotank");
	addOption(document.theform.city, "Perquimans","Perquimans");
	addOption(document.theform.city, "Tyrrell","Tyrrell");
	addOption(document.theform.city, "Washington","Washington");
	}
}
