function dir = type_to_dir(type,skip)

% type_to_dir - extension type string to directory string
% -------------------------------------------------------
% 
% dir = type_to_dir(type,skip)
%
% Input:
% ------
%  type - extension type string
%  skip - skip available types check
%
% Output:
% -------
%  dir - partial directory string

%--------------------------------
% Author: Harold Figueroa
%--------------------------------
% $Revision: 3099 $
% $Date: 2006-01-02 18:05:17 -0500 (Mon, 02 Jan 2006) $
%--------------------------------

%--
% set default no skip
%--

if ((nargin < 2) || isempty(skip))
	skip = 0; 
end

% NOTE: directory organization inverts general and specific in name

%--
% normalize, check, and pluralize type
%--

type = [type_norm(type,skip), 's'];

%--
% parse types to get root directory for type
%--

% NOTE: split on underscore, reverse, and capitalize words

tok = strread(type,'%s','delimiter','_');

dir = '';

for k = length(tok):-1:1
	tok{k}(1) = upper(tok{k}(1)); dir = [dir, filesep, tok{k}];
end

dir = dir(2:end);