function th = sgcredit( author, organization )

%th = sgcredit( author )

if nargin < 1, author = ['Dr. Bradley A. Moran, ' date]; end
if nargin < 2, organization = 'MIT Sea Grant AUV Laboratory'; end

ch = findobj( get(gcf,'children'), 'Type', 'axes', 'Visible', 'on' );

if isempty(ch) return; end		% error if no axes exist

pos = get(ch,'position');
if ( iscell(pos) )
    pos = cat(1, pos{:});		% MATLAB 5 cell concatenation
end

bndRect = [min(pos(:,1:2)) 0 0];	% calculate bounding rectangle
bndRect(3:4) = max(pos(:,1:2) + pos(:,3:4)) - bndRect(1:2);


newAx = axes( 'position', bndRect );	% create new invisible axes
set( newAx, 'Layer', 'Bottom', 'Visible', 'Off', 'Units', 'Normalized' );

th(2) = text( 'string', organization, 'Position', [0 -0.8*bndRect(2)], ...
    'vert', 'top', 'hor', 'left', 'fontangle', 'italic' );

th(1) = text( 'string', author, 'Position', [1 -0.8*bndRect(2)], ...
    'vert', 'top', 'hor', 'right', 'fontangle', 'italic' );
