void CPageDisk::ShowTargetSelection()
{
	Manager			*manager;
	Worker			*worker;
	HTREEITEM		hiface;
	int				w, i, expected_worker, iface_count, wkr_count;
	TargetSelType	state;
	Target_Spec		target_info;

	// Get the selected manager.
	manager = theApp.pView->m_pWorkerView->GetSelectedManager();
	// Get the first disk item from the target tree.
	hiface = m_TTargets.GetRootItem();

	switch ( theApp.pView->m_pWorkerView->GetSelectedType() )
	{
	case WORKER:
		// A worker is selected, show its assigned targets.
		worker = theApp.pView->m_pWorkerView->GetSelectedWorker();

		// Loop through the manager's disks, and mark which ones are selected
		// for the worker.
		iface_count = manager->InterfaceCount( GenericDiskType );
		for ( i = 0; i < iface_count; i++ )
		{
			if ( worker->IsTargetAssigned( manager->GetInterface(i, GenericDiskType)))
				SetSelectionCheck( hiface, TargetChecked );
			else
				SetSelectionCheck( hiface, TargetUnChecked );

			hiface = m_TTargets.GetNextSiblingItem( hiface );
		}
		break;

	case MANAGER:
		// Show the targets assigned to a manager's workers if possible.
		expected_worker = 0;

		// Loop through the manager's disks, and see if they are assigned
		// to the expected worker.  If not, gray all of them and return.
		iface_count = manager->InterfaceCount( GenericDiskType );
		wkr_count = manager->WorkerCount( GenericDiskType );
		for ( i = 0; i < iface_count; i++ )
		{
			memcpy( &target_info, manager->GetInterface( i, GenericDiskType ), 
				sizeof( Target_Spec ) );
			state = TargetUnChecked;
			for ( w = 0; w < wkr_count; w++ )
			{
				// If the disk is selected by any other than expected
				// worker, all the disk check boxes are grayed.
				if ( manager->GetWorker(w, GenericDiskType)->IsTargetAssigned(
					&target_info ) )
				{
					if ( w != expected_worker || state != TargetUnChecked )
					{
						SetAllCheck( TargetGrayed );
						return;
					}
					state = TargetChecked;
					if ( ++expected_worker == wkr_count )
					{
						expected_worker = 0;
					}
				}
			}
			SetSelectionCheck( hiface, state );
			hiface = m_TTargets.GetNextSiblingItem( hiface );
		}
		break;
	default:
		SetAllCheck( TargetGrayed );
		break;
	}
}