function [x,y]=draw(n);
%function [x,(y)]=draw([n]);
%            if no n given, stops drawing when you hit right button on mouse
if nargin==0
           n=2000;
end			  
i=1;
hold on
[x(1,1),x(1,2),ibutton]=ginput(1);
while (i<n)&(ibutton~=2) 
i=i+1;
[x(i,1),x(i,2),ibutton]=ginput(1);
if (ibutton~=2)&(ibutton~=27)
     plot(x( (i-1):i,1),x((i-1):i,2),'c13');
end
end
if (ibutton==2)|(ibutton==27)
   x(i,:)=[];
end
       
plot(x(:,1),x(:,2),'c13')

if nargout==2
  y=x(:,2);
  x=x(:,1);
end


