function drpCategory_onchange(selection)
{
	if (document.all)
	{
	var objSelect = document.all['selCommunity'];
	//remove all the elements from the dropdown
	objSelect.options.length = 0;
	//add the default item to the dropdown
	objSelect.options[0] = new Option("All Communities ....","0");
	
	var iCounter = 1;
	var bFlag = true;
	//populate the dropdown using the new values
		if (document.all['hid'+selection.value]) {
			var arrTemp = document.all['hid'+selection.value].value;
			var arrCommunity = arrTemp.split("~|~");
				for (var j=0; j<arrCommunity.length-1; j++)
				{
					objSelect.options[iCounter] = new Option(arrCommunity[j],arrCommunity[j]);
					iCounter ++; 
				}	
		}	
	} else {
		var objSelect = document.forms[0].selCommunity;

		//remove all the elements from the dropdown
		objSelect.options.length = 0;
		//add the default item to the dropdown
		objSelect.options[0] = new Option("All Communities ....","0");
	
		var iCounter = 1;
		var bFlag = true;
		
		if (document.getElementById('hid'+selection.value).value) {
			var arrTemp = document.getElementById('hid'+selection.value).value;
			var arrCommunity = arrTemp.split("~|~");
				for (var j=0; j<arrCommunity.length-1; j++)
				{
					objSelect.options[iCounter] = new Option(arrCommunity[j],arrCommunity[j]);
					iCounter ++; 
				}	
		}	
	}
}

function showIndexResults()
{
	if (document.all)
	{
		if (document.all['selCategory'].value == "0")
		{
			alert("You must choose a Category to Index!");
			return;
		}
	
		var strCommod = document.all['selCategory'].options[document.all['selCategory'].selectedIndex].text;
		
		var strCat = document.all['hidCITitle'].value;
		
		var strDir = encodeProblemCharacters(document.all['hidCITitle'].value);
		var strArrow = encodeProblemCharacters(document.all['hidCIBullet'].value);
		var strCommunity = document.all['selCommunity'].value;
	} else {
		if (document.forms[0].selCategory.value == "0")
		{
			alert("You must choose a Category to Index!");
			return;
		}
	
		var strCommod = document.forms[0].selCategory.options[document.forms[0].selCategory.selectedIndex].text;
		var strCat = document.getElementById('hidCITitle').value;
		var strDir = encodeProblemCharacters(document.getElementById('hidCITitle').value);
		var strArrow = encodeProblemCharacters(document.getElementById('hidCIBullet').value);
		var strCommunity = document.forms[0].selCommunity.value;
	}

	window.open("/chatham-kent/system/CKDirectory/cityIndexResults.aspx?Directory=" + strDir + "&Commodity="+strCommod + "&Community=" + strCommunity + "&Category="+ strCat + "&Gadget_Arrow_Gif=" + strArrow,"cityIndexService","top=0,left=0,width=730,height=510,resizable=no,scrollbars=yes");

}
