% header setup

\setupoutput[pdftex]
\setupinteraction[state=start]
\setupbodyfont[ss,10pt]

\setuplayout
   [header=6\bodyfontsize,
    headerdistance=\bodyfontsize,
    topspace=0.75cm]

\setuppagenumbering[location=,way=bychapter]
\setupsubpagenumber[state=start,way=bychapter]

\definehead[Mychapter][chapter]
\definecombinedlist[Mycontent][part,Mychapter]
\setuplist[Mychapter][pagenumber=no,maxwidth=\textwidth,margin=1cm]

\define[1]\SetUpHeaderText{%
   \setupheadertexts[][%
   {\hbox
      {\switchtobodyfont[small]%
      {\bTABLE
         \setupTABLE[x][1][frame=on,width=.5\textwidth]
         \setupTABLE[x][2][frame=on,width=.35\textwidth]
         \bTR
            \bTD Document: \hfill\headnumber[part]~\getmarking[part][last] \eTD
            \bTD Version: \hfill{#1}  \eTD\eTR
       \eTABLE}}}]}


\ifx\Version\undefined\def\Version{\currentdate[day,-,month,-,year]}\fi


\starttext
%\showframe

\completeMycontent

\part{General}

\chapter{Introduction}
\def\Version{03-02-2003}
\SetUpHeaderText{\Version}
\writetolist[Mychapter]{Introduction}{\hfill \Version}

\subject{Idea}
\input tufte

\chapter{Troubleshooting}
\def\Version{12-12-2002}
\SetUpHeaderText{\Version}
\writetolist[Mychapter]{Troubleshooting}{\hfill \Version}

\subject{Introduction}
\input tufte

\part{Organisation}
\chapter{Diagrams}
\SetUpHeaderText{05-02-2003}

\subject{Holding}
\input tufte

\subject{Local site}
\input tufte
\stoptext
