function findCategoryId( nSubcatId )
{
	for ( i in arrSubcategories )
	{
		for ( j = 0; j < arrSubcategories[i].length; j++ )
		{
			if ( arrSubcategories[i][j][0] == nSubcatId )
				return i;
		}
	}
	return 0;
}

function onCategoryChanged( strFormName, nCatId, bPrintNull )
{
	var selectSubcategories = getFormElement( strFormName, 'selSubcategory' );
	var i;

	if ( !selectSubcategories )
		return;
	
	selectSubcategories.innerHTML = "";
	
	if ( bPrintNull )
	{
		newOption = document.createElement("OPTION");
		newOption.value = 0;
		newOption.text  = "Please select one";
		selectSubcategories.options.add( newOption );
	}
	
	if ( nCatId == 0 )
		return;
		
	for ( i = 0; i < arrSubcategories[nCatId].length; i++ )
	{
		newOption       = document.createElement("OPTION");
		newOption.value = arrSubcategories[nCatId][i][0];
		newOption.text  = arrSubcategories[nCatId][i][1];
		selectSubcategories.options.add( newOption );
	}
}

