Procedure Border( x,y,xl,yl,t,fg,bg:integer);
{This procedure will draw a double line border. Upper left corner will
 be located at x,y. The border size will be xl by yl. t describes the border
 type 1=double, 2= single, 3=double horiz single vert, 4=vice versa.}

CONST
    s1 = 'É»È¼ºÍ';
    s2 = 'Ú¿ÀÙ³Ä';
    s3 = 'Ö·Ó½ºÄ';
    s4 = 'Õ¸Ô¾³Í';

VAR
    ul,ur,bl,br,up,sd:char;
    tdat:string[6];

Begin

case t of                           {Select border configuration}
     1: tdat:=s1;
     2: tdat:=s2;
     3: tdat:=s3;
     4: tdat:=s4;
end;
ul:=copy(tdat,1,1);
ur:=copy(tdat,2,1);
bl:=copy(tdat,3,1);
br:=copy(tdat,4,1);
up:=copy(tdat,5,1);
sd:=copy(tdat,6,1);

Gotoxy(x,y);
FastWrite(ul,fg,bg,1);                          {Draw top line}
for i:=x to x+xl-3 do FastWrite(sd,fg,bg,1);
FastWrite(ur,fg,bg,1);
for i:=y+1 to y+yl-2 do                       {Draw side bars}
   begin
      gotoxy(x,i);
      FastWrite(up,fg,bg,1);
      gotoxy(x+xl-1,i);
      FastWrite(up,fg,bg,1);
   end;
gotoxy(x,y+yl-1);
FastWrite(bl,fg,bg,1);                          {Draw bottom line}
for i:=x to x+xl-3 do FastWrite(sd,fg,bg,1);
FastWrite(br,fg,bg,1);

end;
