function displaySubcategories(s)
{
	subcategoriesSelect= document.forms[0].elements['CategorySubcategoryID'];

	for (i=0,n=subcategoriesSelect.length;i<n-1;i++) {
			subcategoriesSelect.removeChild(subcategoriesSelect.lastChild); 
	}

	if (subcategories[s]) {
		for(var sub in subcategories[s]) {
			subcategoriesSelect.options[subcategoriesSelect.length] = new Option( subcategories[s][sub]['CategoryName'], subcategories[s][sub]['CategoryID'] );
			if (subcategories[s][sub]['CategoryID'] == categoryID) {
				subcategoriesSelect.options[subcategoriesSelect.length-1].selected = 1;
			}
		}
	}
}


function displayCounties(c)
{
	countiesSelect = document.forms[0].elements['CountyID'];

	for (i=0,n=countiesSelect.length;i<n-1;i++) {
		countiesSelect.removeChild(countiesSelect.lastChild); 
	}

	if (counties[c]) {
		for(var sub in counties[c]) {
			countiesSelect.options[countiesSelect.length] = new Option( counties[c][sub]['CountyName'], counties[c][sub]['CountyID'] );
			if (counties[c][sub]['CountyID'] == countyId) {
				countiesSelect.options[countiesSelect.length-1].selected = 1;
			}
		}
	}
}


function displayCountiesSearch(c)
{
	countiesSelect = document.forms['search'].elements['CountyIDFilter'+'[]'];

	for (i=0,n=countiesSelect.length;i<n-1;i++) {
		countiesSelect.removeChild(countiesSelect.lastChild); 
	}

	if (counties[c]) {
		for(var sub in counties[c]) {
			countiesSelect.options[countiesSelect.length] = new Option( counties[c][sub]['CountyName'], counties[c][sub]['CountyID'] );
			if (counties[c][sub]['CountyIDFilter'+'[]'] == countyId) {
				countiesSelect.options[countiesSelect.length-1].selected = 1;
			}
		}
	}
}


function displayCountiesRegister(c)
{
	countiesSelect = document.forms['register'].elements['CountyID'];

	for (i=0,n=countiesSelect.length;i<n-1;i++) {
		countiesSelect.removeChild(countiesSelect.lastChild); 
	}

	if (counties[c]) {
		for(var sub in counties[c]) {
			countiesSelect.options[countiesSelect.length] = new Option( counties[c][sub]['CountyName'], counties[c][sub]['CountyID'] );
			if (counties[c][sub]['CountyID'] == countyId) {
				countiesSelect.options[countiesSelect.length-1].selected = 1;
			}
		}
	}
}


function displayCountiesEmailManager(c)
{
	countiesSelect = document.forms[0].elements['CountyID'+'[]'];

	for (i=0,n=countiesSelect.length;i<n-1;i++) {
		countiesSelect.removeChild(countiesSelect.lastChild); 
	}

	if (counties[c]) {
		for(var sub in counties[c]) {
			countiesSelect.options[countiesSelect.length] = new Option( counties[c][sub]['CountyName'], counties[c][sub]['CountyID'] );
			if (counties[c][sub]['CountyID'+'[]'] == countyId) {
				countiesSelect.options[countiesSelect.length-1].selected = 1;
			}
		}
	}
}