function updateSchools(selectedStateGroup){
	divNameInput = document.getElementById('schoolname_input');
	divNameSelect = document.getElementById('schoolname_select');
	divINPUT = document.getElementById('schoolcity_input');
	divTXT = document.getElementById('schoolcity_text');

	var schoollist = document.formname.REG_JDEAN8;
	
	notInList_Container = document.getElementById('schoolnotlisted');

	// First thing to do is make sure the check box for 'My School Is Not Listed' is unchecked
		document.formname.schoolnotinlist.checked = false;
	
	
	// Now, before we generate the drop down box, check to make sure a state they chose contains schools.  If it
	// doesn't, then show the input fields
		if(schools[selectedStateGroup].length == 1){
			divINPUT.style.display = "";
			divTXT.style.display = "none";			
			divNameInput.style.display = "";
			divNameSelect.style.display = "none";
			
			// Get the JDEAddress Number from the webother[] array.
				var stateAbbr = selectedStateGroup;
				var REG_JDEAN8_AddressNumber = webother[stateAbbr];
				document.formname.REG_JDEAN8_Manual.value = REG_JDEAN8_AddressNumber;	
				//alert(REG_JDEAN8_AddressNumber);
				
			// Since the user chose a state that doesn't have any options, make sure the checkbox for 'My School Is Not Listed' isn't shown					
				notInList_Container.style.display = "none";
				
				setFieldsToBlank("regular");
				
				document.formname.VT_schoolNameManual.focus();
			
		}
		else{
	
				notInList_Container.style.display = "";
	
			// Now make the select box and other appropriate input's appear.  For the others, make them disappear
				divINPUT.style.display = "none";
				divTXT.style.display = "";			
				divNameInput.style.display = "none";
				divNameSelect.style.display = "";
			
			// For the School City text, set it to nothing
				divTXT.innerHTML = "";
				
				
			// Now comes the generation of the drop down box.	
		
				schoollist.disabled = false;
				schoollist.options.length=0
				if (selectedStateGroup != "-"){
					for (i=0; i<schools[selectedStateGroup].length; i++)
					schoollist.options[schoollist.options.length]=new Option(schools[selectedStateGroup][i].split("|")[0],schools[selectedStateGroup][i].split("|")[1])
				}
				
			// Since the user chose a state, make sure the checkbox for 'My School Is Not Listed' is enabled
				document.formname.schoolnotinlist.disabled = false;
				
			setFieldsToBlank("manual");
				
		
		}
}




function updateCity(REG_JDEAN8, selectedIndex){

	var selectedSchool;

	divTXT = document.getElementById('schoolcity_text');
	divTXT.innerHTML = cities[REG_JDEAN8];
	document.formname.VT_schoolCity.value = cities[REG_JDEAN8];
	//document.formname.VT_schoolCity.value = cities[selectedSchool];
	
	selectedSchool = document.formname.REG_JDEAN8[selectedIndex].text;
	document.formname.VT_schoolName.value = selectedSchool;

}

function toggleManualSchoolEntry(checked){

	divINPUT = document.getElementById('schoolcity_input');
	divTXT = document.getElementById('schoolcity_text');
	
	divNameInput = document.getElementById('schoolname_input');
	divNameSelect = document.getElementById('schoolname_select');

	if(checked){
		divINPUT.style.display = "";
		divTXT.style.display = "none";
		
		divNameInput.style.display = "";
		divNameSelect.style.display = "none";
		
		
		
		// Before we exit the function, we need to get the WEB ACCOUNT address number
		// for this state.  This value will be stored as the REG_JDEAN8 value for this user
		// since they aren't associated with any other school in the list
		
		// Get the JDEAddress Number from the webother[] array.
		var stateAbbr = document.formname.VT_schoolState[document.formname.VT_schoolState.selectedIndex].value;
		var REG_JDEAN8_AddressNumber = webother[stateAbbr];
		document.formname.REG_JDEAN8_Manual.value = REG_JDEAN8_AddressNumber;
		
		setFieldsToBlank("regular");
		
		document.formname.VT_schoolNameManual.focus();
		
	}
	else{
		divINPUT.style.display = "none";
		divTXT.style.display = "";
		
		divNameInput.style.display = "none";
		divNameSelect.style.display = "";
		
		setFieldsToBlank("manual");
	}
}

function setFieldsToBlank(whichOne){

	if(whichOne == "manual"){
		document.formname.REG_JDEAN8_Manual.value = "";
		document.formname.VT_schoolNameManual.value = "";
		document.formname.VT_schoolCityManual.value = "";
	}
	else{
		document.formname.REG_JDEAN8.options[0].selected = true;
		document.formname.VT_schoolName.value = "";
		document.formname.VT_schoolCity.value = "";
		
		divTXT = document.getElementById('schoolcity_text');
		divTXT.innerHTML = "";
	}
}