procedure TMyWin.MenuFileSave(var Msg: TMessage);
var
   i, reply : integer;
   fname : text;
   aCheck: Check;
begin
     if ((not IsEmpty(CheckBook)) and isDirty) then
        if (not isNewFile) then
           begin
             Assign(fname, FileName);
             ReWrite(Fname);
             Writeln(FName, ListLength(CheckBook));
             for i := ListLength(CheckBook) downto 1 do begin
                 Findith(CheckBook, i);
                 Retrieve(CheckBook, aCheck);
                 WriteCheckToFile(aCheck, fname);
             end;
             Close(Fname);
             isDirty := false;
             isSaved := true;
           end
        else
           MenuFileSaveAs(Msg);
end;