function [node,flag]=picknod(meshnod)
%  [node,flag]=picknode(meshnod);
%  This creates a cross hair for picking a particular node
%    flag == -1 if returned if pick is left of plot
%    flag == +1 if returned if pick is right of plot
%    flag == +i if returned if pick is above plot
%    flag == -i if returned if pick is below plot
%    flag == 0 if node number is returned from inside plot
%    flag == 999  if no node is found ?  (How could it happen?)
%
%   if you call it with an index vector be sure to unindex it: 
%   [node,flag]= picknode(meshnod(ll,:));
%   node = ll(node);

L = axis;
[x,y]=ginput(1);
if     x<L(1) 
flag = -1;
elseif x>L(2)
flag = 1;
elseif y<L(3)
flag = -i;
elseif y>L(4)
flag = i;
else 
flag = 0;
end
 

d = (x-meshnod(:,2)).^2+(y-meshnod(:,3)).^2;
node = find(d==min(d));
