%    Copyright (C) 1995-1998
%    Massachussetts Institute of Technology
%    Sea Grant AUV Laboratory
%    $Id: o2_crdit.m,v 1.1 2000/01/10 19:08:13 rob Exp $	

function th = credit( string )

if nargin < 1, string = 'B. A. Moran'; end

ch = get( gcf, 'children' );
for i = 1:length(ch)
    aunit = get( ch(i), 'unit' );
    set( ch(i), 'unit', 'norm' );
    arect = get( ch(i), 'pos' );
    if i == 1
        rrect = arect;
        rchld = ch(i);
    else
        if arect(1) + arect(3) > rrect(1) + rrect(3)
            rrect = arect;
            rchld = ch(i);
        end
    end    
    set( ch(i), 'unit', aunit );
end

restore_unit = get( rchld, 'unit' );
set( rchld, 'unit', 'norm' );
restore_axis = gca;
axes( rchld );
pos = [1 (0.05 - rrect(2))/rrect(4)];
th = text( 'string', string, 'pos', pos, 'unit','norm', ...
    'vert', 'top', 'hor', 'right', 'fontsize', 9, 'fontangle', 'italic' );
set( rchld, 'unit', restore_unit );
axes( restore_axis );
