function dismoor(command)
% function to display the present mooring elements in the command window

global moorele H B X Y Z Ti iobj jobj psi

if nargin==0,
   command=0;
end
mmp=80;
line0='0                                                                                     ';
[mm,nm]=size(moorele);
if mm>mmp, mmp=mm;end
io=0;
jo=0;
clear line
hdr1='#  Mooring Element   Length[m] Buoy[kg] Height[m] dX[m] dY[m] Tension[kg] Angle[deg]';
hdr2='                                                              Top  Bottom Top Bottom';
%     123456789112345678921234567893123456789412345678951234567896123456789712345678981234
if command==1, % then print to printer
   pf=figure(5);clf
   axis off
   fs=10;
   if mm>mmp, fs=10*mmp/mm; end
   set(pf,'PaperOrient','Portrait','PaperUnits',...
      'Normalized','PaperPosition',[0 0 1 1],'Visible','on');
   dates=num2str(fix(clock),'%3.0f');dates(8)='/';dates([14 17])=':';
   tit=['Mooring Design and Dynamics  ',dates];
   ht=title(tit);
   pos=get(ht,'Position');
   set(ht,'Position',[pos(1) pos(2)*1.02 pos(3)],'Fontname','Courier','FontSize',fs*1.2);
   orient tall
   ypos=1+2/mmp;
   h=text(-0.1,ypos,hdr1);
   set(h,'Units','Normalized','Position',[-0.075 ypos],'Fontname','Courier','FontSize',fs);
   ypos=1+1/mmp;
   h=text(-0.1,ypos,hdr2);
   set(h,'Units','Normalized','Position',[-0.075 ypos],'Fontname','Courier','FontSize',fs);
 else
    disp(' ');
    disp(hdr1);
    disp(hdr2);
end
%
for el=1:mm,
   line=line0;
   tmp=num2str(el,'%2.0f');
   line(3-length(tmp):2)=tmp;
   line(4:19)=moorele(el,:);
   tmp=num2str(H(1,el),'%8.2f');
   line(30-length(tmp):29)=tmp;
   tmp=num2str(B(el),'%8.2f');
   line(39-length(tmp):38)=tmp;
   if ~isempty(Z) & H(4,el) == 0,
      io=io+1;
      tmp=num2str(Z(iobj(io)),'%9.1f');
      line(49-length(tmp):48)=tmp;
      tmp=num2str(X(iobj(io)),'%5.1f');
      line(55-length(tmp):54)=tmp;
      tmp=num2str(Y(iobj(io)),'%5.1f');
      line(61-length(tmp):60)=tmp;
   elseif ~isempty(Z) & H(4,el) == 1,
      jo=jo+1;
      tmp=num2str(Ti(jobj(jo))/9.81,'%6.1f');
      line(67-length(tmp):66)=tmp;
      tmp=num2str(psi(jobj(jo))*180/pi,'%4.1f');
      line(79-length(tmp):78)=tmp;
      jo=jo+1;
      tmp=num2str(Ti(jobj(jo))/9.81,'%6.1f');
      line(74-length(tmp):73)=tmp;
      tmp=num2str(psi(jobj(jo))*180/pi,'%4.1f');
      line(85-length(tmp):84)=tmp;
   end
   if ~isempty(Z) & el == mm,
      tmp=num2str(Ti(length(Ti)-1)/9.81,'%8.1f');
      line(71-length(tmp):70)=tmp;
      tmp=num2str(psi(length(psi)-1)*180/pi,'%4.1f');
      line(79-length(tmp):78)=tmp;
   end
   if command==1,
      figure(5);
      ypos=1-el/mmp;
      h=text(-0.1,ypos,line);
      set(h,'Units','normalized','Position',[-0.075 ypos],'FontName','Courier','FontSize',fs);
   else
      disp(line);
   end
end;
if command==1,
   figure(5);
   orient tall;
   % wysiwyg
   unis = get(gcf,'units');
   ppos = get(gcf,'paperposition');
   set(gcf,'units',get(gcf,'paperunits'));
   pos  = get(gcf,'position');
   pos(3:4) = ppos(3:4);
   set(gcf,'position',pos);
   set(gcf,'units',unis);
   %set(pf,'Visible','off');
   print -f5;
   %print -dps MDDout.ps   % if you want a postscript file
   close(5);
else
   disp(' ');
end

% fini
