function SCREENWinToFront(window,bufferWindow,dx,dy,theClut);
% SCREENWinToFront(window,bufferWindow,[dx],[dy],[theClut])
%
% Put the command window behind again.  This is meant
% to used in conjunction with CmdWinToUpperLeft.
%
% See also CmdWinToUpperLeft
%
% 3/5/97  dhb  Wrote it.

% Restore clut if passed.
if (nargin == 5)
	if (~isempty(theClut))
		Screen(window,'SetClut',theClut);
	end
end

% Shift command window by -dx, -dy if passed.
if (nargin >= 4)
	if (~isempty(dx) & ~isempty(dy))
		cWindow = Screen('GetMatlabWindow');
		Screen(cWindow,'MoveWindow',-dx,-dy);
	end
end

% Restore Screen window
Screen(window,'WindowToFront');
Screen('CopyWindow',bufferWindow,window);


