\unprotect

\setuppapersize
  [A4] [A4]

\setuplayout
  [topspace=110mm,
   backspace=24mm,
   bottomspace=22mm,
   width=162mm,
   header=0mm,
   footer=0mm]

\def\setupletter{%
  \dosingleargument\dosetupletter}

\def\dosetupletter[#1]{%
  \getparameters[dinbrief@][#1]}

\def\DummyLetterHead{%
  \position(20mm,20mm){%
    \framed[width=170mm,height=20mm]{letter head}}}

\def\DummyBackAddress{%
  \position(0mm,0mm){%
    \framed[width=85mm,height=5mm]{back address}}}

\def\DummyAddress{%
  \position(0mm,2mm){%
    \framed[width=85mm,height=38mm]{address}}}

\def\DummyInfo{%
  \position(20mm,2mm){%
    \framed[width=65mm,height=53mm]{information}}}

\def\DummyLetterFoot{%
  \position(20mm,0mm){%
    \framed[width=170mm,height=7mm]{letter foot}}}

\setupletter
  [foldmarks=on,
   letterhead=\DummyLetterHead,
   backaddress=\DummyBackAddress,
   address=\DummyAddress,
   info=\DummyInfo,
   letterfoot=\DummyLetterFoot]

\definelayer
  [dinbrief@layer@letterhead]

\setlayer
  [dinbrief@layer@letterhead]
  [x=0mm,y=0mm,width=210mm,height=45mm]
  {\getvalue{dinbrief@letterhead}}

\definelayer
  [dinbrief@layer@foldmarkA]

\setlayer
  [dinbrief@layer@foldmarkA]
  [x=7.5mm,y=104.5mm,width=2.5mm,height=1mm]
  {\framed[width=2.5mm,height=1mm,frame=off]{%
      \doifvalue{dinbrief@foldmarks}{on}{\hairline}}}

\definelayer
  [dinbrief@layer@punchmark]

\setlayer
  [dinbrief@layer@punchmark]
  [x=5.0mm,y=148.0mm,width=5mm,height=1mm]
  {\framed[width=5mm,height=1mm,frame=off]{%
      \doifvalue{dinbrief@foldmarks}{on}{\hairline}}}

\definelayer
  [dinbrief@layer@foldmarkB]

\setlayer
  [dinbrief@layer@foldmarkB]
  [x=7.5mm,y=191.5mm,width=2.5mm,height=1mm]
  {\framed[width=2.5mm,height=1mm,frame=off]{%
      \doifvalue{dinbrief@foldmarks}{on}{\hairline}}}

\definelayer
  [dinbrief@layer@backaddress]

\setlayer
  [dinbrief@layer@backaddress]
  [x=20mm,y=45mm,width=85mm,height=5mm]
  {\getvalue{dinbrief@backaddress}}

\definelayer
  [dinbrief@layer@address]

\setlayer
  [dinbrief@layer@address]
  [x=20mm,y=50mm,width=85mm,height=40mm]
  {\getvalue{dinbrief@address}}

\definelayer
  [dinbrief@layer@info]

\setlayer
  [dinbrief@layer@info]
  [x=105mm,y=50mm,width=105mm,height=55mm]
  {\getvalue{dinbrief@info}}

\definelayer
  [dinbrief@layer@letterfoot]

\setlayer
  [dinbrief@layer@letterfoot]
  [x=0mm,y=280mm,width=210mm,height=17mm]
  {\getvalue{dinbrief@letterfoot}}

\setupbackgrounds
  [page]
  [background={%
    dinbrief@layer@letterhead,dinbrief@layer@foldmarkA,%
    dinbrief@layer@punchmark,dinbrief@layer@foldmarkB,%
    dinbrief@layer@backaddress,dinbrief@layer@address,%
    dinbrief@layer@info,dinbrief@layer@letterfoot}]

\protect

\endinput
