% Copyright 2006 Konstantin Korikov <lostclus@ua.fm>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
% 
% This Current Maintainer of this work is Konstantin Korikov.
%
% This work consists of all files listed in manifest.txt.
%

%
% This is automaticaly generated file, do not edit it.
%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{xespdstamp}[2011/05/06 v0.98 Stamp GOST 2.104-68]

\RequirePackage{calc}

\newcommand{\XESPD@paper}{a4}

\newif\ifXESPD@landscape
\XESPD@landscapefalse
\newif\ifXESPD@given@landscape
\XESPD@given@landscapefalse

\newcommand{\XESPD@default@style@title}{title}
\newcommand{\XESPD@default@style@first}{formII}
\newcommand{\XESPD@default@style@other}{formIIab}

\newlength{\XESPD@margin@si}
\newlength{\XESPD@margin@so}
\newlength{\XESPD@margin@t}
\newlength{\XESPD@margin@b}
\setlength{\XESPD@margin@si}{20mm}
\setlength{\XESPD@margin@so}{5mm}
\setlength{\XESPD@margin@t}{5mm}
\setlength{\XESPD@margin@b}{5mm}

\newlength{\XESPDlineThick}
\newlength{\XESPDlineThin}
\setlength{\XESPDlineThick}{.4mm}
\setlength{\XESPDlineThin}{.2mm}

\newlength{\XESPD@padding@h}
\newlength{\XESPD@padding@v}
\setlength{\XESPD@padding@h}{0mm}
\setlength{\XESPD@padding@v}{5mm}

\newif\ifXESPD@ignstamp
\XESPD@ignstampfalse

\newif\ifXESPD@enable@column@vii
\XESPD@enable@column@viitrue
\newif\ifXESPD@given@column@vii
\XESPD@given@column@viifalse

\newif\ifXESPD@enable@column@viii
\XESPD@enable@column@viiitrue

\newif\ifXESPD@enable@columns@xix
\XESPD@enable@columns@xixtrue

\newif\ifXESPD@enable@columns@xxiv
\XESPD@enable@columns@xxivfalse

\newif\ifXESPD@enable@column@xxvi
\XESPD@enable@column@xxvifalse

\newif\ifXESPD@enable@columns@xxvii
\XESPD@enable@columns@xxviifalse

\newif\ifXESPD@enable@column@xxxi
\XESPD@enable@column@xxxitrue

\newif\ifXESPD@enable@column@xxxii
\XESPD@enable@column@xxxiitrue

\newif\ifXESPD@enable@column@xxxiii
\XESPD@enable@column@xxxiiifalse

\newif\ifXESPD@enable@column@xxxiv
\XESPD@enable@column@xxxivfalse

\newif\ifXESPD@twoside
\XESPD@twosidefalse

\newif\ifXESPD@zonelabels
\XESPD@zonelabelsfalse

\RequirePackage{keyval}

\DeclareOption{a0paper}{\renewcommand{\XESPD@paper}{a0}}
\DeclareOption{a1paper}{\renewcommand{\XESPD@paper}{a1}}
\DeclareOption{a2paper}{\renewcommand{\XESPD@paper}{a2}}
\DeclareOption{a3paper}{\renewcommand{\XESPD@paper}{a3}}
\DeclareOption{a4paper}{\renewcommand{\XESPD@paper}{a4}}
\DeclareOption{landscape}{%
  \XESPD@landscapetrue%
  \XESPD@given@landscapetrue}
\DeclareOption{portrait}{%
  \XESPD@landscapefalse%
  \XESPD@given@landscapetrue}
\define@key{xespd}{reduceheight}{\addtolength{\XESPD@margin@b}{#1}}
\DeclareOption{formI}{%
  \renewcommand{\XESPD@default@style@first}{formI}
  \renewcommand{\XESPD@default@style@other}{formIIab}
  \renewcommand{\XESPD@default@style@title}{title}}
\DeclareOption{formII}{%
  \renewcommand{\XESPD@default@style@first}{formII}
  \renewcommand{\XESPD@default@style@other}{formIIab}
  \renewcommand{\XESPD@default@style@title}{title}}
\DeclareOption{emptystyle}{%
  \renewcommand{\XESPD@default@style@first}{empty}
  \renewcommand{\XESPD@default@style@other}{empty}
  \renewcommand{\XESPD@default@style@title}{empty}}
\DeclareOption{xespd}{%
  \setlength{\XESPD@margin@t}{20mm}%
  \setlength{\XESPD@margin@b}{10mm}%
  \setlength{\XESPD@margin@si}{20mm}
  \setlength{\XESPD@margin@so}{10mm}
  \renewcommand{\XESPD@default@style@first}{empty}
  \renewcommand{\XESPD@default@style@other}{empty}
  \renewcommand{\XESPD@default@style@title}{xespdtitle}}
\DeclareOption{stitching}{\setlength{\XESPD@margin@si}{20mm}}
\DeclareOption{nostitching}{%
  \setlength{\XESPD@margin@si}{5mm}%
  \XESPD@enable@columns@xixfalse%
  \XESPD@enable@columns@xxivfalse}
\DeclareOption{ignorestamp}{\XESPD@ignstamptrue}
\DeclareOption{noignorestamp}{\XESPD@ignstampfalse}
\DeclareOption{columnvii}{%
  \XESPD@enable@column@viitrue%
  \XESPD@given@column@viitrue}
\DeclareOption{nocolumnvii}{
  \XESPD@enable@column@viifalse%
  \XESPD@given@column@viitrue}
\DeclareOption{columnviii}{\XESPD@enable@column@viiitrue}
\DeclareOption{nocolumnviii}{\XESPD@enable@column@viiifalse}
\DeclareOption{columnsxix}{\XESPD@enable@columns@xixtrue}
\DeclareOption{nocolumnsxix}{\XESPD@enable@columns@xixfalse}
\DeclareOption{columnsxxiv}{\XESPD@enable@columns@xxivtrue}
\DeclareOption{nocolumnsxxiv}{\XESPD@enable@columns@xxivfalse}
\DeclareOption{columnxxvi}{\XESPD@enable@column@xxvitrue}
\DeclareOption{nocolumnxxvi}{\XESPD@enable@column@xxvifalse}
\DeclareOption{columnsxxvii}{\XESPD@enable@columns@xxviitrue}
\DeclareOption{nocolumnsxxvii}{\XESPD@enable@columns@xxviifalse}
\DeclareOption{columnxxxi}{\XESPD@enable@column@xxxitrue}
\DeclareOption{nocolumnxxxi}{\XESPD@enable@column@xxxifalse}
\DeclareOption{columnxxxii}{\XESPD@enable@column@xxxiitrue}
\DeclareOption{nocolumnxxxii}{\XESPD@enable@column@xxxiifalse}
\DeclareOption{columnxxxiii}{\XESPD@enable@column@xxxiiitrue}
\DeclareOption{nocolumnxxxiii}{\XESPD@enable@column@xxxiiifalse}
\DeclareOption{columnxxxiv}{\XESPD@enable@column@xxxivtrue}
\DeclareOption{nocolumnxxxiv}{\XESPD@enable@column@xxxivfalse}
\DeclareOption{simple}{%
  \XESPD@enable@columns@xixfalse%
  \XESPD@enable@column@xxxifalse%
  \XESPD@enable@column@xxxiifalse}
\DeclareOption{twoside}{\XESPD@twosidetrue}
\DeclareOption{oneside}{\XESPD@twosidefalse}
\DeclareOption{zonelabels}{\XESPD@zonelabelstrue}
\DeclareOption{nozonelabels}{\XESPD@zonelabelsfalse}
\define@key{xespd}{linethick}{\setlength{\XESPDlineThick}{#1}}
\define@key{xespd}{linethin}{\setlength{\XESPDlineThin}{#1}}
\define@key{xespd}{vpadding}{\setlength{\XESPD@padding@v}{#1}}
\define@key{xespd}{hpadding}{\setlength{\XESPD@padding@h}{#1}}

\DeclareOption*{\edef\@tempa{\noexpand\setkeys{xespd}{\CurrentOption}}\@tempa}

\ProcessOptions\relax

\newcommand{\XESPD@cmp@empty}{}
\newcommand{\XESPD@cmp@aIVpaper}{a4}
\newcommand{\XESPD@cmp@landscape}{landscape}

\ifXESPD@given@landscape\else
  \ifx\XESPD@paper\XESPD@cmp@aIVpaper%
    \XESPD@landscapefalse
    \else
    \XESPD@landscapetrue
  \fi
\fi

\RequirePackage[\XESPD@paper paper,%
\ifXESPD@landscape landscape\else portrait\fi,%
tmargin=\XESPD@margin@t+\XESPD@padding@v,%
bmargin=\XESPD@margin@b+\XESPD@padding@v,%
inner=\XESPD@margin@si+\XESPD@padding@h,%
outer=\XESPD@margin@so+\XESPD@padding@h,%
marginparsep=0mm,marginparwidth=0mm,%
headheight=0mm,headsep=0mm,footskip=0mm]{geometry}

\RequirePackage{lastpage}

\def\XESPD@secondof#1#2#3endof{#2}
\def\XESPD@p@genum#1{%
  \ifx#1\relax 0\else
   \expandafter\XESPD@secondof#1endof
  \fi}
\def\XESPD@pagenum#1{\expandafter\XESPD@p@genum\csname r@#1\endcsname}

\ifXESPD@given@column@vii\else
  \AtBeginDocument{%
    \ifnum \XESPD@pagenum{LastPage} = 1
      \XESPD@enable@column@viifalse%
    \fi}
\fi

\newif\ifXESPD@column@xxvi@portrait
\XESPD@column@xxvi@portraittrue
\ifXESPD@landscape\XESPD@column@xxvi@portraitfalse\fi
\ifx\XESPD@paper\XESPD@cmp@aIVpaper\XESPD@column@xxvi@portraitfalse\fi

\newlength{\XESPD@tmpdima}
\newlength{\XESPD@tmpdimb}
\newlength{\XESPD@tmpdimc}

\newcount\XESPD@tmpcnta
\newcount\XESPD@tmpcntb

\newcount\XESPD@zonelabel@hc
\newcount\XESPD@zonelabel@vc
\newlength{\XESPD@zonelabel@hs}
\newlength{\XESPD@zonelabel@vs}
\newcount\XESPD@zonelabel@cnt
\ifXESPD@zonelabels
  \@namedef{XESPD@zonelabel@init@a4}{%
    \XESPD@zonelabel@hc = 1 \XESPD@zonelabel@vc = 1\relax}
  \@namedef{XESPD@zonelabel@init@a3}{%
    \XESPD@zonelabel@hc = 1 \XESPD@zonelabel@vc = 2\relax}
  \@namedef{XESPD@zonelabel@init@a2}{%
    \XESPD@zonelabel@hc = 2 \XESPD@zonelabel@vc = 2\relax}
  \@namedef{XESPD@zonelabel@init@a1}{%
    \XESPD@zonelabel@hc = 2 \XESPD@zonelabel@vc = 4\relax}
  \@namedef{XESPD@zonelabel@init@a0}{%
    \XESPD@zonelabel@hc = 4 \XESPD@zonelabel@vc = 4\relax}
  \@nameuse{XESPD@zonelabel@init@\XESPD@paper}
  \ifXESPD@landscape
    \XESPD@tmpcnta = \XESPD@zonelabel@hc
    \XESPD@zonelabel@hc = \XESPD@zonelabel@vc
    \XESPD@zonelabel@vc = \XESPD@tmpcnta
  \fi
  \XESPD@zonelabel@hs = \paperwidth
  \XESPD@zonelabel@vs = \paperheight
  \divide \XESPD@zonelabel@hs by \XESPD@zonelabel@hc
  \divide \XESPD@zonelabel@vs by \XESPD@zonelabel@vc
  \XESPD@zonelabel@cnt = 0
\fi

\newlength{\XESPD@origin@x}
\newlength{\XESPD@origin@y}
\setlength{\XESPD@origin@x}{1in}
\setlength{\XESPD@origin@y}{\paperheight-1in}

\newlength{\XESPDframeX}
\newlength{\XESPDframeY}

\newlength{\XESPDframeW}
\newlength{\XESPDframeH}
\setlength{\XESPDframeW}{\paperwidth-\XESPD@margin@si-\XESPD@margin@so}
\setlength{\XESPDframeH}{\paperheight-\XESPD@margin@t-\XESPD@margin@b}

\newlength{\XESPDstampX}
\newlength{\XESPDstampY}

\RequirePackage{xespdfont}
\RequirePackage{xespdlang}

\newcommand*{\XESPDltu}[1]{#1\@gobble}

\newcommand{\XESPDonFrontSideOnly}[1]{%
  \ifXESPD@twoside\ifodd\c@page#1\fi\else#1\fi}

\RequirePackage{rotating}

\newsavebox{\XESPD@frame@box}
\AtBeginDocument{%
\savebox{\XESPD@frame@box}{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)(0,0)
\linethickness{\XESPDlineThick}
\put(0,\XESPDltu{\XESPDframeH}){\line(1,0){\XESPDltu{\XESPDframeW}}}
\put(0,0){\line(1,0){\XESPDltu{\XESPDframeW}}}
\put(0,0){\line(0,1){\XESPDltu{\XESPDframeH}}}
\put(\XESPDltu{\XESPDframeW},0){\line(0,1){\XESPDltu{\XESPDframeH}}}
\end{picture}}}
\newcommand{\XESPDdrawFrame}{%
  \put(\XESPDltu{\XESPDframeX},\XESPDltu{\XESPDframeY}){%
    \usebox{\XESPD@frame@box}}}

\newsavebox{\XESPD@stamp@i@box}
\AtBeginDocument{%
\savebox{\XESPD@stamp@i@box}{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)(0,0)
\linethickness{\XESPDlineThick}
\put(0,55){\line(1,0){185}}
\put(65,40){\line(1,0){120}}
\put(0,35){\line(1,0){65}}
\put(135,35){\line(1,0){50}}
\put(0,30){\line(1,0){65}}
\put(135,20){\line(1,0){50}}
\put(65,15){\line(1,0){120}}
\linethickness{\XESPDlineThin}
\multiput(0,50)(0,-5){3}{\line(1,0){65}}
\multiput(0,25)(0,-5){5}{\line(1,0){65}}
\linethickness{\XESPDlineThick}
\put(0,0){\line(0,1){55}}
\put(7,30){\line(0,1){25}}
\put(17,0){\line(0,1){55}}
\put(40,0){\line(0,1){55}}
\put(55,0){\line(0,1){55}}
\put(65,0){\line(0,1){55}}
\put(135,0){\line(0,1){40}}
\put(150,20){\line(0,1){20}}
\put(155,15){\line(0,1){5}}
\put(167,20){\line(0,1){20}}
\linethickness{\XESPDlineThin}
\multiput(140,20)(5,0){2}{\line(0,1){15}}
\put(67, 41){\parbox[b][13mm][c]{106mm}{\centering\XESPDfontVII\XESPDtheColumnII}}
\put(135, 36.3){\makebox[15mm]{\XESPDfontIII\XESPDcolumnIVname}}
\put(150, 36.3){\makebox[17mm]{\XESPDfontIII\XESPDcolumnVname}}
\put(167, 36.3){\makebox[18mm]{\XESPDfontIII\XESPDcolumnVIname}}
\put(0.5, 26.3){\makebox[16mm][l]{\XESPDfontIII\XESPDcolumnXfIname}}
\put(0.5, 21.3){\makebox[16mm][l]{\XESPDfontIII\XESPDcolumnXfIIname}}
\put(0.5, 16.3){\makebox[16mm][l]{\XESPDfontIII\XESPDcolumnXfIIIname}}
\put(0.5, 11.3){\makebox[16mm][l]{\XESPDfontIII\XESPDcolumnXfIVname}}
\put(0.5, 6.3){\makebox[16mm][l]{\XESPDfontIII\XESPDcolumnXfVname}}
\put(0.5, 1.3){\makebox[16mm][l]{\XESPDfontIII\XESPDcolumnXfVIname}}
\put(17.5, 26.3){\makebox[22mm][l]{\XESPDfontIII\XESPDtheColumnXIfI}}
\put(17.5, 21.3){\makebox[22mm][l]{\XESPDfontIII\XESPDtheColumnXIfII}}
\put(17.5, 16.3){\makebox[22mm][l]{\XESPDfontIII\XESPDtheColumnXIfIII}}
\put(17.5, 11.3){\makebox[22mm][l]{\XESPDfontIII\XESPDtheColumnXIfIV}}
\put(17.5, 6.3){\makebox[22mm][l]{\XESPDfontIII\XESPDtheColumnXIfV}}
\put(17.5, 1.3){\makebox[22mm][l]{\XESPDfontIII\XESPDtheColumnXIfVI}}
\put(0, 31.3){\makebox[7mm]{\XESPDfontIII\XESPDcolumnXIVname}}
\put(7, 31.3){\makebox[10mm]{\XESPDfontIII\XESPDcolumnXVname}}
\put(17, 31.3){\makebox[23mm]{\XESPDfontIII\XESPDcolumnXVIname}}
\put(40, 31.3){\makebox[15mm]{\XESPDfontIII\XESPDcolumnXVIIname}}
\put(55, 31.3){\makebox[10mm]{\XESPDfontIII\XESPDcolumnXVIIIname}}
\end{picture}}}
\newcommand{\XESPD@stamp@i@var}{%
\begin{picture}(0,0)(0,0)
\ifnum \c@page = 1
  \put(67, 16){\parbox[b][23mm][c]{66mm}{\centering\XESPDfontV\XESPDtheColumnI}}
  \put(67, 1){\parbox[b][13mm][c]{66mm}{\centering\XESPDfontV\XESPDtheColumnIII}}
  \put(135, 26.3){\makebox[5mm]{\XESPDfontIII\XESPDtheColumnIVfI}}
  \put(140, 26.3){\makebox[5mm]{\XESPDfontIII\XESPDtheColumnIVfII}}
  \put(145, 26.3){\makebox[5mm]{\XESPDfontIII\XESPDtheColumnIVfIII}}
  \put(151, 21){\parbox[b][13mm][c]{15mm}{\centering\XESPDfontIII\XESPDtheColumnV}}
  \put(168, 21){\parbox[b][13mm][c]{16mm}{\centering\XESPDfontIII\XESPDtheColumnVI}}
  \ifXESPD@enable@column@viii
    \put(155, 16.3){\makebox[30mm]{\XESPDfontIII%
      \ifXESPD@twoside\XESPDcolumnVIIItwosideName\else\XESPDcolumnVIIIname\fi%
      \ \pageref{LastPage}}}
  \fi
  \put(137, 1){\parbox[b][13mm][c]{46mm}{\centering\XESPDfontV\XESPDtheColumnIX}}
\fi
\ifXESPD@enable@column@vii
  \put(135, 16.3){\makebox[20mm]{\XESPDfontIII%
    \ifXESPD@twoside\XESPDcolumnVIItwosideName\else\XESPDcolumnVIIname\fi\ \thepage}}
\fi
\end{picture}}
\newcommand{\XESPDdrawStampI}{%
  \put(\XESPDltu{\XESPDstampX},\XESPDltu{\XESPDstampY}){%
    \usebox{\XESPD@stamp@i@box}}
  \put(\XESPDltu{\XESPDstampX},\XESPDltu{\XESPDstampY}){%
    \XESPD@stamp@i@var}}

\newsavebox{\XESPD@stamp@ii@box}
\AtBeginDocument{%
\savebox{\XESPD@stamp@ii@box}{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)(0,0)
\linethickness{\XESPDlineThick}
\put(0,40){\line(1,0){185}}
\put(0,30){\line(1,0){65}}
\put(0,25){\line(1,0){185}}
\put(135,20){\line(1,0){50}}
\put(135,15){\line(1,0){50}}
\linethickness{\XESPDlineThin}
\put(0,35){\line(1,0){65}}
\multiput(0,20)(0,-5){4}{\line(1,0){65}}
\linethickness{\XESPDlineThick}
\put(0,0){\line(0,1){40}}
\put(7,25){\line(0,1){15}}
\put(17,0){\line(0,1){40}}
\put(40,0){\line(0,1){40}}
\put(55,0){\line(0,1){40}}
\put(65,0){\line(0,1){40}}
\put(135,0){\line(0,1){25}}
\put(140,15){\line(0,1){5}}
\put(145,15){\line(0,1){5}}
\put(150,15){\line(0,1){10}}
\put(165,15){\line(0,1){10}}
\put(67, 1){\parbox[b][23mm][c]{66mm}{\centering\XESPDfontV\XESPDtheColumnI}}
\put(67, 26){\parbox[b][13mm][c]{106mm}{\centering\XESPDfontVII\XESPDtheColumnII}}
\put(135, 21.3){\makebox[15mm]{\XESPDfontIII\XESPDcolumnIVname}}
\put(135, 16.3){\makebox[5mm][c]{\XESPDfontIII\XESPDtheColumnIVfI}}
\put(140, 16.3){\makebox[5mm][c]{\XESPDfontIII\XESPDtheColumnIVfII}}
\put(145, 16.3){\makebox[5mm][c]{\XESPDfontIII\XESPDtheColumnIVfIII}}
\put(150, 21.3){\makebox[15mm]{\XESPDfontIII%
  \ifXESPD@twoside\XESPDcolumnVIItwosideName\else\XESPDcolumnVIIname\fi}}
\put(165, 21.3){\makebox[20mm]{\XESPDfontIII%
  \ifXESPD@twoside\XESPDcolumnVIIItwosideName\else\XESPDcolumnVIIIname\fi}}
\put(137, 1){\parbox[b][13mm][c]{46mm}{\centering\XESPDfontV\XESPDtheColumnIX}}
\put(0.5, 21.3){\makebox[16mm][l]{\XESPDfontIII\XESPDcolumnXfIname}}
\put(0.5, 16.3){\makebox[16mm][l]{\XESPDfontIII\XESPDcolumnXfIIname}}
\put(0.5, 11.3){\makebox[16mm][l]{\XESPDfontIII\XESPDcolumnXfIVname}}
\put(0.5, 6.3){\makebox[16mm][l]{\XESPDfontIII\XESPDcolumnXfVname}}
\put(0.5, 1.3){\makebox[16mm][l]{\XESPDfontIII\XESPDcolumnXfVIname}}
\put(17.5, 21.3){\makebox[22mm][l]{\XESPDfontIII\XESPDtheColumnXIfI}}
\put(17.5, 16.3){\makebox[22mm][l]{\XESPDfontIII\XESPDtheColumnXIfII}}
\put(17.5, 11.3){\makebox[22mm][l]{\XESPDfontIII\XESPDtheColumnXIfIV}}
\put(17.5, 6.3){\makebox[22mm][l]{\XESPDfontIII\XESPDtheColumnXIfV}}
\put(17.5, 1.3){\makebox[22mm][l]{\XESPDfontIII\XESPDtheColumnXIfVI}}
\put(0, 26.3){\makebox[7mm]{\XESPDfontIII\XESPDcolumnXIVname}}
\put(7, 26.3){\makebox[10mm]{\XESPDfontIII\XESPDcolumnXVname}}
\put(17, 26.3){\makebox[23mm]{\XESPDfontIII\XESPDcolumnXVIname}}
\put(40, 26.3){\makebox[15mm]{\XESPDfontIII\XESPDcolumnXVIIname}}
\put(55, 26.3){\makebox[10mm]{\XESPDfontIII\XESPDcolumnXVIIIname}}
\end{picture}}}
\newcommand{\XESPD@stamp@ii@var}{%
\begin{picture}(0,0)(0,0)
\ifXESPD@enable@column@vii
  \put(150, 16.3){\makebox[15mm]{\XESPDfontIII\thepage}}
\fi
\ifXESPD@enable@column@viii
  \put(165, 16.3){\makebox[20mm]{\XESPDfontIII\pageref{LastPage}}}
\fi
\end{picture}}
\newcommand{\XESPDdrawStampII}{%
  \put(\XESPDltu{\XESPDstampX},\XESPDltu{\XESPDstampY}){%
    \usebox{\XESPD@stamp@ii@box}}
  \put(\XESPDltu{\XESPDstampX},\XESPDltu{\XESPDstampY}){%
    \XESPD@stamp@ii@var}}

\newsavebox{\XESPD@stamp@ii@a@box}
\AtBeginDocument{%
\savebox{\XESPD@stamp@ii@a@box}{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)(0,0)
\linethickness{\XESPDlineThick}
\put(0,15){\line(1,0){185}}
\put(175,8){\line(1,0){10}}
\put(0,5){\line(1,0){65}}
\linethickness{\XESPDlineThin}
\put(0,10){\line(1,0){65}}
\linethickness{\XESPDlineThick}
\put(0,0){\line(0,1){15}}
\put(7,0){\line(0,1){15}}
\put(17,0){\line(0,1){15}}
\put(40,0){\line(0,1){15}}
\put(55,0){\line(0,1){15}}
\put(65,0){\line(0,1){15}}
\put(175,0){\line(0,1){15}}
\put(67, 1){\parbox[b][13mm][c]{106mm}{\centering\XESPDfontVII\XESPDtheColumnII}}
\put(175, 10.3){\makebox[10mm]{\XESPDfontIII%
  \ifXESPD@twoside\XESPDcolumnVIItwosideName\else\XESPDcolumnVIIname\fi}}
\put(0, 1.3){\makebox[7mm]{\XESPDfontIII\XESPDcolumnXIVname}}
\put(7, 1.3){\makebox[10mm]{\XESPDfontIII\XESPDcolumnXVname}}
\put(17, 1.3){\makebox[23mm]{\XESPDfontIII\XESPDcolumnXVIname}}
\put(40, 1.3){\makebox[15mm]{\XESPDfontIII\XESPDcolumnXVIIname}}
\put(55, 1.3){\makebox[10mm]{\XESPDfontIII\XESPDcolumnXVIIIname}}
\end{picture}}}
\newcommand{\XESPD@stamp@ii@a@var}{%
\begin{picture}(0,0)(0,0)
\ifXESPD@enable@column@vii
  \put(175, 3){\makebox[10mm]{\XESPDfontIII\thepage}}
\fi
\end{picture}}
\newcommand{\XESPDdrawStampIIa}{%
  \put(\XESPDltu{\XESPDstampX},\XESPDltu{\XESPDstampY}){%
    \usebox{\XESPD@stamp@ii@a@box}}
  \put(\XESPDltu{\XESPDstampX},\XESPDltu{\XESPDstampY}){%
    \XESPD@stamp@ii@a@var}}

\newsavebox{\XESPD@stamp@ii@b@box}
\AtBeginDocument{%
\savebox{\XESPD@stamp@ii@b@box}{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)(0,0)
\linethickness{\XESPDlineThick}
\put(0,15){\line(1,0){185}}
\put(0,8){\line(1,0){10}}
\put(120,5){\line(1,0){65}}
\linethickness{\XESPDlineThin}
\put(120,10){\line(1,0){65}}
\linethickness{\XESPDlineThick}
\put(0,0){\line(0,1){15}}
\put(10,0){\line(0,1){15}}
\put(120,0){\line(0,1){15}}
\put(127,0){\line(0,1){15}}
\put(137,0){\line(0,1){15}}
\put(160,0){\line(0,1){15}}
\put(175,0){\line(0,1){15}}
\put(12, 1){\parbox[b][13mm][c]{106mm}{\centering\XESPDfontVII\XESPDtheColumnII}}
\put(0, 10.3){\makebox[10mm]{\XESPDfontIII%
  \ifXESPD@twoside\XESPDcolumnVIItwosideName\else\XESPDcolumnVIIname\fi}}
\put(120, 1.3){\makebox[7mm]{\XESPDfontIII\XESPDcolumnXIVname}}
\put(127, 1.3){\makebox[10mm]{\XESPDfontIII\XESPDcolumnXVname}}
\put(137, 1.3){\makebox[23mm]{\XESPDfontIII\XESPDcolumnXVIname}}
\put(160, 1.3){\makebox[15mm]{\XESPDfontIII\XESPDcolumnXVIIname}}
\put(175, 1.3){\makebox[10mm]{\XESPDfontIII\XESPDcolumnXVIIIname}}
\end{picture}}}
\newcommand{\XESPD@stamp@ii@b@var}{%
\begin{picture}(0,0)(0,0)
\ifXESPD@enable@column@vii
  \put(0, 3){\makebox[10mm]{\XESPDfontIII\thepage}}
\fi
\end{picture}}
\newcommand{\XESPDdrawStampIIb}{%
  \put(\XESPDltu{\XESPDstampX},\XESPDltu{\XESPDstampY}){%
    \usebox{\XESPD@stamp@ii@b@box}}
  \put(\XESPDltu{\XESPDstampX},\XESPDltu{\XESPDstampY}){%
    \XESPD@stamp@ii@b@var}}

% Рамка
\ifXESPD@enable@columns@xix
\newsavebox{\XESPD@columns@xix@box}
\AtBeginDocument{%
\savebox{\XESPD@columns@xix@box}{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)(-5,0)
\linethickness{\XESPDlineThick}
\put(0,12){\line(1,0){145}}
\put(0,7){\line(1,0){145}}
\put(0,0){\line(1,0){145}}
\put(0,0){\line(0,1){12}}
\put(25,0){\line(0,1){12}}
\put(60,0){\line(0,1){12}}
\put(85,0){\line(0,1){12}}
\put(110,0){\line(0,1){12}}
\put(145,0){\line(0,1){12}}
\put(0, 8.3){\makebox[25mm]{\XESPDfontGostIV\XESPDcolumnXIXname}}
\put(0, 2.3){\makebox[25mm]{\XESPDfontGostIV\XESPDtheColumnXIX}}
\put(25, 8.3){\makebox[35mm]{\XESPDfontGostIV\XESPDcolumnXXname}}
\put(60, 8.3){\makebox[25mm]{\XESPDfontGostIV\XESPDcolumnXXIname}}
\put(60, 2.3){\makebox[25mm]{\XESPDfontGostIV\XESPDtheColumnXXI}}
\put(85, 8.3){\makebox[25mm]{\XESPDfontGostIV\XESPDcolumnXXIIname}}
\put(85, 2.3){\makebox[25mm]{\XESPDfontGostIV\XESPDtheColumnXXII}}
\put(110, 8.3){\makebox[35mm]{\XESPDfontGostIV\XESPDcolumnXXIIIname}}
\put(145, 7){\makebox[35mm]{\scriptsize{3237~\CYRV\CYRP}}}
\put(145, 3){\makebox[35mm]{\scriptsize{\CYRM\CYRO~\CYRR\CYRF}}}
\end{picture}}}
\newcommand{\XESPDdrawColumnsXIX}{%
  \XESPDonFrontSideOnly{%
    \put(\XESPDltu{\XESPDframeX},\XESPDltu{\XESPDframeY}){%
      \begin{turn}{90}\usebox{\XESPD@columns@xix@box}\end{turn}}}}
\fi

\ifXESPD@enable@columns@xxiv
\newsavebox{\XESPD@columns@xxiv@box}
\AtBeginDocument{%
\savebox{\XESPD@columns@xxiv@box}{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)(0,0)
\linethickness{\XESPDlineThick}
\put(0,12){\line(1,0){120}}
\put(0,7){\line(1,0){120}}
\put(0,0){\line(0,1){12}}
\put(60,0){\line(0,1){12}}
\put(120,0){\line(0,1){12}}
\put(0, 8.3){\makebox[60mm]{\XESPDfontIII\XESPDcolumnXXIVname}}
\put(0, 2.3){\makebox[60mm]{\XESPDfontIII\XESPDtheColumnXXIV}}
\put(60, 8.3){\makebox[60mm]{\XESPDfontIII\XESPDcolumnXXVname}}
\put(60, 2.3){\makebox[60mm]{\XESPDfontIII\XESPDtheColumnXXV}}
\end{picture}}}
\newcommand{\XESPDdrawColumnsXXIV}{%
  \setlength{\XESPD@tmpdima}{\XESPDframeY+167mm}
  \put(\XESPDltu{\XESPDframeX},\XESPDltu{\XESPD@tmpdima}){%
    \begin{turn}{90}\usebox{\XESPD@columns@xxiv@box}\end{turn}}}
\fi

\ifXESPD@enable@column@xxvi
\newsavebox{\XESPD@column@xxvi@box}
\AtBeginDocument{%
\savebox{\XESPD@column@xxvi@box}{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)(0,0)
\linethickness{\XESPDlineThick}
\put(0,0){\line(1,0){70}}
\put(70,0){\line(0,1){14}}
\put(1,13){\begin{turn}{180}\parbox[b][12mm][c]{68mm}{%
  \centering\XESPDfontV\XESPDtheColumnII}\end{turn}}
\end{picture}}}
\newcommand{\XESPDdrawColumnXXVI}{%
  \ifXESPD@column@xxvi@portrait%
    \setlength{\XESPD@tmpdima}{\XESPDframeX+\XESPDframeW-14mm}%
    \setlength{\XESPD@tmpdimb}{\XESPDframeY+\XESPDframeH}%
    \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){%
      \begin{turn}{270}\usebox{\XESPD@column@xxvi@box}\end{turn}}%
  \else%
    \setlength{\XESPD@tmpdima}{\XESPDframeY+\XESPDframeH-14mm}%
    \put(\XESPDltu{\XESPDframeX},\XESPDltu{\XESPD@tmpdima}){%
      \usebox{\XESPD@column@xxvi@box}}%
  \fi}
\fi

\ifXESPD@enable@columns@xxvii
\newsavebox{\XESPD@columns@xxvii@i@box}
\AtBeginDocument{%
\savebox{\XESPD@columns@xxvii@i@box}{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)(0,0)
\linethickness{\XESPDlineThick}
\put(14,7){\line(1,0){53}}
\put(0,0){\line(1,0){67}}
\put(14,0){\line(0,1){14}}
\put(67,0){\line(0,1){14}}
\put(0,13){\begin{turn}{180}\parbox[b][12mm][c]{14mm}{%
  \centering\XESPDfontV\XESPDtheColumnXXVII}\end{turn}}
\put(14,11.7){\begin{turn}{180}\makebox[53mm][c]{%
  \XESPDfontIII\XESPDtheColumnXXVIII}\end{turn}}
\put(14,4.7){\begin{turn}{180}\makebox[53mm][c]{%
  \XESPDfontIII\XESPDtheColumnXXIX}\end{turn}}
\end{picture}}}
\newsavebox{\XESPD@columns@xxvii@ii@box}
\AtBeginDocument{%
\savebox{\XESPD@columns@xxvii@ii@box}{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)(0,0)
\linethickness{\XESPDlineThick}
\put(0,14){\line(1,0){120}}
\put(0,0){\line(0,1){14}}
\put(14,0){\line(0,1){14}}
\put(67,0){\line(0,1){14}}
\put(0,0){\parbox[b][14mm][c]{14mm}{%
  \centering\XESPDfontIII\XESPDtheColumnXXVII}}
\put(15,0){\parbox[b][14mm][c]{51mm}{%
  \centering\XESPDfontIII\XESPDtheColumnXXVIII}}
\put(68,0){\parbox[b][14mm][c]{51mm}{%
  \centering\XESPDfontIII\XESPDtheColumnXXIX}}
\end{picture}}}
\newsavebox{\XESPD@column@xxx@box}
\AtBeginDocument{%
\savebox{\XESPD@column@xxx@box}{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)(0,0)
\linethickness{\XESPDlineThick}
\put(0,8){\line(1,0){120}}
\put(0,0){\line(0,1){8}}
\put(1,1){\parbox[b][6mm][c]{118mm}{\centering\XESPDfontV\XESPDtheColumnXXX}}
\end{picture}}}
\newcommand{\XESPDdrawColumnsXXVIIi}{%
  \ifXESPD@column@xxvi@portrait%
    \setlength{\XESPD@tmpdima}{\XESPDframeX+\XESPDframeW-14mm}%
    \setlength{\XESPD@tmpdimb}{\XESPDframeY+\XESPDframeH-70mm}%
    \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){%
      \begin{turn}{270}\usebox{\XESPD@columns@xxvii@i@box}\end{turn}}%
  \else%
    \setlength{\XESPD@tmpdima}{\XESPDframeX+70mm}%
    \setlength{\XESPD@tmpdimb}{\XESPDframeY+\XESPDframeH-14mm}%
    \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){%
      \usebox{\XESPD@columns@xxvii@i@box}}%
  \fi%
  \setlength{\XESPD@tmpdima}{\XESPDstampX+65mm}%
  \setlength{\XESPD@tmpdimb}{\XESPDstampY+55mm}%
  \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){%
    \usebox{\XESPD@column@xxx@box}}}%
\newcommand{\XESPDdrawColumnsXXVIIii}{%
  \setlength{\XESPD@tmpdima}{\XESPDstampX+65mm}
  \setlength{\XESPD@tmpdimb}{\XESPDstampY+48mm}
  \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){%
    \usebox{\XESPD@columns@xxvii@ii@box}}%
  \setlength{\XESPD@tmpdimb}{\XESPDstampY+40mm}%
  \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){%
    \usebox{\XESPD@column@xxx@box}}}
\fi

\ifXESPD@enable@column@xxxi
\newcommand{\XESPDdrawColumnXXXI}{%
  \setlength{\XESPD@tmpdima}{\XESPDframeX+\XESPDframeW-120mm}%
  \setlength{\XESPD@tmpdimb}{\XESPDframeY-3.7mm}%
  \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){%
    \makebox[70mm][r]{\XESPDfontIII\XESPDcolumnXXXIname\hspace{4em}}}}
\fi

\ifXESPD@enable@column@xxxii
\newcommand{\XESPDdrawColumnXXXII}{%
  \setlength{\XESPD@tmpdima}{\XESPDframeX+\XESPDframeW-50mm}%
  \setlength{\XESPD@tmpdimb}{\XESPDframeY-3.7mm}%
  \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){%
    \makebox[50mm][r]{\XESPDfontIII\XESPDtheColumnXXXII}}}
\fi

\ifXESPD@enable@column@xxxiii
\newsavebox{\XESPD@column@xxxiii@box}
\AtBeginDocument{%
\savebox{\XESPD@column@xxxiii@box}{%
\setlength{\unitlength}{1mm}%
\begin{picture}(0,0)(0,0)
\linethickness{\XESPDlineThick}
\put(0,25){\line(1,0){20}}
\put(0,5){\line(1,0){20}}
\put(0,0){\line(1,0){20}}
\put(0,0){\line(0,1){25}}
\linethickness{\XESPDlineThin}
\multiput(0,20)(0,-5){3}{\line(1,0){20}}
\put(0,1.3){\makebox[20mm][c]{\XESPDfontIII\XESPDcolumnXXXIIIname}}
\end{picture}}}
\newcommand{\XESPDdrawColumnXXXIII}{%
  \setlength{\XESPD@tmpdima}{\XESPDstampX-20mm}%
  \setlength{\XESPD@tmpdimb}{\XESPDstampY+30mm}%
  \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){%
    \usebox{\XESPD@column@xxxiii@box}}}
\fi

\ifXESPD@enable@column@xxxiv
\newsavebox{\XESPD@column@xxxiv@box}
\AtBeginDocument{%
\savebox{\XESPD@column@xxxiv@box}{%
\setlength{\fboxrule}{\XESPDlineThick}%
\setlength{\fboxsep}{1.3mm}%
\parbox[b][100mm+\fboxrule][t]{70mm+\fboxrule}{%
  \framebox{%
    \parbox{70mm-2\fboxsep-\fboxrule}{\centering\XESPDfontIII%
      \XESPDtheColumnXXXIV\rule{0mm}{7mm-2\fboxsep-\fboxrule}}}}}}
\newcommand{\XESPDdrawColumnXXXIV}{%
  \ifXESPD@column@xxvi@portrait%
    \setlength{\XESPD@tmpdima}{%
      \XESPDframeX+\XESPDframeW-114mm-.5\XESPDlineThick}%
    \setlength{\XESPD@tmpdimb}{%
      \XESPDframeY+\XESPDframeH+.5\XESPDlineThick}%
    \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){%
      \begin{turn}{270}\usebox{\XESPD@column@xxxiv@box}\end{turn}}%
  \else%
    \setlength{\XESPD@tmpdima}{\XESPDframeX-.5\XESPDlineThick}%
    \setlength{\XESPD@tmpdimb}{%
      \XESPDframeY+\XESPDframeH-114mm-.5\XESPDlineThick}%
    \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){%
      \usebox{\XESPD@column@xxxiv@box}}%
  \fi}
\fi

\ifXESPD@zonelabels
\newcommand{\XESPD@make@h@zonelabels}{
  \XESPD@tmpcnta = 1
  \XESPD@tmpdima = \paperwidth
  \XESPD@tmpdimb = \XESPDframeY
  \advance \XESPD@tmpdimb \XESPDframeH
  \XESPD@tmpdimc = \XESPDframeY
  \advance \XESPD@tmpdimc -5mm
  \loop
    \advance \XESPD@tmpdima -\XESPD@zonelabel@hs
    \global\advance \XESPD@zonelabel@cnt 1
    \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){%
      \parbox[b][5mm][c]{\XESPD@zonelabel@hs}{%
	\centering\XESPDfontIII\number\XESPD@zonelabel@cnt}}
    \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimc}){%
      \parbox[b][5mm][c]{\XESPD@zonelabel@hs}{%
	\centering\XESPDfontIII\number\XESPD@zonelabel@cnt}}
  \ifnum \XESPD@tmpcnta < \XESPD@zonelabel@hc
    \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimb}){\line(0,1){5}}
    \put(\XESPDltu{\XESPD@tmpdima},\XESPDltu{\XESPD@tmpdimc}){\line(0,1){5}}
    \advance \XESPD@tmpcnta 1
  \repeat
}
\newcommand{\XESPD@make@v@zonelabels}[1]{
  \XESPD@tmpcnta = 1
  \XESPD@tmpdima = 0mm
  \XESPD@tmpdimb = \XESPDframeX
  \advance \XESPD@tmpdimb -5mm
  \XESPD@tmpdimc = \XESPDframeX
  \advance \XESPD@tmpdimc \XESPDframeW
  \loop
    \put(\XESPDltu{\XESPD@tmpdimb},\XESPDltu{\XESPD@tmpdima}){%
      \parbox[b][\XESPD@zonelabel@vs][c]{5mm}{%
	\centering\XESPDfontIII\@Alph\XESPD@tmpcnta
	\ifnum\XESPD@tmpcnta = 1
	  \ifXESPD@enable@columns@xix
	    \par\rule{0mm}{3.5mm-\XESPD@zonelabel@vs+310mm}
	  \fi
	\fi}}
    \put(\XESPDltu{\XESPD@tmpdimc},\XESPDltu{\XESPD@tmpdima}){%
      \parbox[b][\XESPD@zonelabel@vs][c]{5mm}{%
	\centering\XESPDfontIII\@Alph\XESPD@tmpcnta}}
  \ifnum \XESPD@tmpcnta < \XESPD@zonelabel@vc
    \advance \XESPD@tmpdima \XESPD@zonelabel@vs
    \ifnum \XESPD@tmpcnta = #1\else
      \put(\XESPDltu{\XESPD@tmpdimb},\XESPDltu{\XESPD@tmpdima}){\line(1,0){5}}
    \fi
    \put(\XESPDltu{\XESPD@tmpdimc},\XESPDltu{\XESPD@tmpdima}){\line(1,0){5}}
    \advance \XESPD@tmpcnta 1
  \repeat
}
\newcommand{\XESPDdrawZoneLabelsI}{%
\linethickness{\XESPDlineThick}
\XESPD@make@h@zonelabels
\ifXESPD@enable@columns@xxiv
  \ifdim \XESPD@zonelabel@vs < 292mm
    \XESPD@make@v@zonelabels{1}\else
    \XESPD@make@v@zonelabels{0}\fi
\else
  \XESPD@make@v@zonelabels{0}
\fi
\ifdim \XESPD@margin@si > 5mm
  \XESPD@tmpdima = \XESPDframeY
  \XESPD@tmpdimb = \XESPDframeX
  \advance \XESPD@tmpdimb -5mm
  \ifXESPD@enable@columns@xix\else
    \put(\XESPDltu{\XESPD@tmpdimb},\XESPDltu{\XESPD@tmpdima}){%
      \line(0,1){145}}
  \fi
  \advance \XESPD@tmpdima 145mm
  \put(\XESPDltu{\XESPD@tmpdimb},\XESPDltu{\XESPD@tmpdima}){%
    \line(0,1){22}}
  \advance \XESPD@tmpdima 22mm
  \ifXESPD@enable@columns@xxiv\else
    \put(\XESPDltu{\XESPD@tmpdimb},\XESPDltu{\XESPD@tmpdima}){%
      \line(0,1){120}}
  \fi
  \advance \XESPD@tmpdima 120mm
  \XESPD@tmpdimc = \XESPDframeY
  \advance \XESPD@tmpdimc \XESPDframeH
  \advance \XESPD@tmpdimc -\XESPD@tmpdima
  \put(\XESPDltu{\XESPD@tmpdimb},\XESPDltu{\XESPD@tmpdima}){%
    \line(0,1){\XESPDltu{\XESPD@tmpdimc}}}
  \advance \XESPD@tmpdima \XESPD@tmpdimc
  \put(\XESPDltu{\XESPD@tmpdimb},\XESPDltu{\XESPD@tmpdima}){%
    \line(1,0){5}}
\fi}
\newcommand{\XESPDdrawZoneLabelsII}{%
\linethickness{\XESPDlineThick}
\XESPD@make@h@zonelabels
\XESPD@make@v@zonelabels{0}
\ifdim \XESPD@margin@si > 5mm
  \XESPD@tmpdima = \XESPDframeY
  \XESPD@tmpdimb = \XESPDframeX
  \advance \XESPD@tmpdimb -5mm
  \ifXESPD@enable@columns@xix\else
    \put(\XESPDltu{\XESPD@tmpdimb},\XESPDltu{\XESPD@tmpdima}){%
      \line(0,1){145}}
  \fi
  \advance \XESPD@tmpdima 145mm
  \XESPD@tmpdimc = \XESPDframeY
  \advance \XESPD@tmpdimc \XESPDframeH
  \advance \XESPD@tmpdimc -\XESPD@tmpdima
  \put(\XESPDltu{\XESPD@tmpdimb},\XESPDltu{\XESPD@tmpdima}){%
    \line(0,1){\XESPDltu{\XESPD@tmpdimc}}}
  \advance \XESPD@tmpdima \XESPD@tmpdimc
  \put(\XESPDltu{\XESPD@tmpdimb},\XESPDltu{\XESPD@tmpdima}){%
    \line(1,0){5}}
\fi}
\fi

\RequirePackage{xespdhash}

\newcommand{\XESPDnewStyle}[2]{%
  \XESPD@hash@new{@style@draw@#1}%
  \@namedef{XESPD@style@sh@#1}{#2}}

\newcommand{\XESPDputOnStyle}[3]{%
  \XESPD@hash@set{@style@draw@#1}{#2}{#3}}
\newcommand{\XESPDremoveFromStyle}[2]{%
  \XESPD@hash@set{@style@draw@#1}{#2}{}}

\XESPDnewStyle{empty}{0mm}

\XESPDnewStyle{title}{0mm}
\XESPDputOnStyle{title}{frame}{\XESPDdrawFrame}
\ifXESPD@enable@columns@xix
  \XESPDputOnStyle{title}{columnsxix}{\XESPDdrawColumnsXIX}
\fi

\XESPDnewStyle{formI}{\ifXESPD@enable@columns@xxvii 63mm\else 55mm\fi}
\XESPDputOnStyle{formI}{frame}{\XESPDdrawFrame}
\XESPDputOnStyle{formI}{stamp}{\XESPDdrawStampI}
\ifXESPD@enable@columns@xix
  \XESPDputOnStyle{formI}{columnsxix}{\XESPDdrawColumnsXIX}
\fi
\ifXESPD@enable@columns@xxiv
  \XESPDputOnStyle{formI}{columnsxxiv}{\XESPDdrawColumnsXXIV}
\fi
\ifXESPD@enable@column@xxvi
  \XESPDputOnStyle{formI}{columnxxvi}{\XESPDdrawColumnXXVI}
\fi
\ifXESPD@enable@columns@xxvii
  \XESPDputOnStyle{formI}{columnsxxvii}{\XESPDdrawColumnsXXVIIi}
\fi
\ifXESPD@enable@column@xxxi
  \XESPDputOnStyle{formI}{columnxxxi}{\XESPDdrawColumnXXXI}
\fi
\ifXESPD@enable@column@xxxii
  \XESPDputOnStyle{formI}{columnxxxii}{\XESPDdrawColumnXXXII}
\fi
\ifXESPD@enable@column@xxxiii
  \XESPDputOnStyle{formI}{columnxxxiii}{\XESPDdrawColumnXXXIII}
\fi
\ifXESPD@enable@column@xxxiv
  \XESPDputOnStyle{formI}{columnxxxiv}{\XESPDdrawColumnXXXIV}
\fi
\ifXESPD@zonelabels%
  \XESPDputOnStyle{formI}{zonelabels}{\XESPDdrawZoneLabelsI}
\fi

\XESPDnewStyle{formII}{\ifXESPD@enable@columns@xxvii 62mm\else 40mm\fi}
\XESPDputOnStyle{formII}{frame}{\XESPDdrawFrame}
\XESPDputOnStyle{formII}{stamp}{\XESPDdrawStampII}
\ifXESPD@enable@columns@xix
  \XESPDputOnStyle{formII}{columnsxix}{\XESPDdrawColumnsXIX}
\fi
\ifXESPD@enable@columns@xxiv
  \XESPDputOnStyle{formII}{columnsxxiv}{\XESPDdrawColumnsXXIV}
\fi
\ifXESPD@enable@columns@xxvii
  \XESPDputOnStyle{formII}{columnsxxvii}{\XESPDdrawColumnsXXVIIii}
\fi
\ifXESPD@enable@column@xxxi
  \XESPDputOnStyle{formII}{columnxxxi}{\XESPDdrawColumnXXXI}
\fi
\ifXESPD@enable@column@xxxii
  \XESPDputOnStyle{formII}{columnxxxii}{\XESPDdrawColumnXXXII}
\fi

\XESPDnewStyle{formIIab}{15mm}
\XESPDputOnStyle{formIIab}{frame}{\XESPDdrawFrame}
\XESPDputOnStyle{formIIab}{stamp}{%
  \ifXESPD@twoside%
    \ifodd\c@page\XESPDdrawStampIIa\else\XESPDdrawStampIIb\fi%
  \else\XESPDdrawStampIIa\fi}
\ifXESPD@enable@columns@xix
  \XESPDputOnStyle{formIIab}{columnsxix}{%
    \ifXESPD@twoside\ifodd\c@page\XESPDdrawColumnsXIX\fi%
    \else\XESPDdrawColumnsXIX\fi}
\fi
\ifXESPD@enable@column@xxxi
  \XESPDputOnStyle{formIIab}{columnxxxi}{\XESPDdrawColumnXXXI}
\fi
\ifXESPD@enable@column@xxxii
  \XESPDputOnStyle{formIIab}{columnxxxii}{\XESPDdrawColumnXXXII}
\fi
\ifXESPD@zonelabels
  \XESPDputOnStyle{formIIab}{zonelabels}{\XESPDdrawZoneLabelsII}
\fi

\XESPDnewStyle{xespdtitle}{0mm}
\ifXESPD@enable@columns@xix
  \XESPDputOnStyle{xespdtitle}{columnsxix}{\XESPDdrawColumnsXIX}
\fi

\newlength{\XESPD@curpad@h}
\newlength{\XESPD@curpad@v}
\setlength{\XESPD@curpad@h}{\XESPD@padding@h}
\setlength{\XESPD@curpad@v}{\XESPD@padding@v}

\RequirePackage{everyshi}
\def\XESPD@curstyle{}
\def\XESPD@thisstyle{}
\def\XESPD@extra@Hook{}
\def\XESPD@extra@ThisHook{}
\newcommand{\XESPD@ShipoutPicture}{%
  \bgroup
    \ifXESPD@twoside
      \ifodd\c@page
        \XESPDframeX=\XESPD@margin@si
      \else
        \XESPDframeX=\XESPD@margin@so
      \fi
    \else
      \XESPDframeX=\XESPD@margin@si
    \fi
    \XESPDframeY=\XESPD@margin@b
    \XESPDstampX=\XESPDframeX
    \advance\XESPDstampX \XESPDframeW
    \advance\XESPDstampX -185mm
    \XESPDstampY=\XESPDframeY
    \unitlength=1mm
    \global\setbox\@cclv\vbox{%
      \vbox{\let\protect\relax
	\begin{picture}(0,0)(\XESPDltu{\XESPD@origin@x},\XESPDltu{\XESPD@origin@y})%
	  \ifx\XESPD@thisstyle\@empty
	    \let\XESPD@thisstyle\XESPD@curstyle
	  \fi
	  \loop
	  \ifnum \XESPD@hash@pos{@style@draw@\XESPD@thisstyle} %
	    < \XESPD@hash@count{@style@draw@\XESPD@thisstyle}
	    \XESPD@hash@next@value{@style@draw@\XESPD@thisstyle}\relax
	  \repeat
	  \ifx\XESPD@extra@ThisHook\@empty%
	    \XESPD@extra@Hook\else\XESPD@extra@ThisHook%
	  \fi%
	  \global\let\XESPD@thisstyle\@empty%
	  \global\let\XESPD@extra@ThisHook\@empty%
	\end{picture}}%
	\nointerlineskip%
      \box\@cclv}%
  \egroup
}
\EveryShipout{\XESPD@ShipoutPicture}

\RequirePackage{chngpage}
\RequirePackage{ifpdf}

% \XESPD@tmpdima --- width
% \XESPD@tmpdimb --- height
\newcommand{\XESPDstyle}[1]{%
\pagestyle{empty}%
\def\XESPD@curstyle{#1}%
\ifpdf%
  \setlength{\XESPD@tmpdimb}{\pdfpageheight}%
  \setlength{\XESPD@tmpdima}{\pdfpagewidth}%
\else%
  \setlength{\XESPD@tmpdima}{\paperwidth}%
  \setlength{\XESPD@tmpdimb}{\paperheight}%
\fi%
\changetext{\XESPD@tmpdimb-\XESPD@margin@t-\XESPD@margin@b-2\XESPD@curpad@v%
  \expandafter-\@nameuse{XESPD@style@sh@\ifXESPD@ignstamp empty\else #1\fi}-\textheight}%
  {\XESPD@tmpdima-\XESPD@margin@si-\XESPD@margin@so-2\XESPD@padding@h-\textwidth}{}{}{}%
\let\XESPD@thisstyle\@empty}

\newcommand{\XESPDthisStyle}[1]{%
\thispagestyle{empty}%
\def\XESPD@thisstyle{#1}%
\ifpdf%
  \setlength{\XESPD@tmpdimb}{\pdfpageheight}%
\else%
  \setlength{\XESPD@tmpdimb}{\paperheight}%
\fi%
\setlength{\vsize}{\XESPD@tmpdimb-\XESPD@margin@t-\XESPD@margin@b-2\XESPD@curpad@v%
  \expandafter-\@nameuse{XESPD@style@sh@\ifXESPD@ignstamp empty\else #1\fi}}%
\setlength{\@colht}{\vsize}\setlength{\@colroom}{\vsize}}

\newcommand{\XESPDput}[1]{\def\XESPD@extra@Hook{#1}}
\newcommand{\XESPDthisPut}[1]{\def\XESPD@extra@ThisHook{#1}}

\newcommand{\XESPDclearDoublePage}{%
  \ifXESPD@twoside%
    \clearpage%
    \ifodd\c@page\else\XESPDthisStyle{empty}\rule{0mm}{0mm}\newpage\fi%
  \else\clearpage\fi}

\XESPDstyle{\XESPD@default@style@other}
\AtBeginDocument{%
  \ifx\XESPD@default@style@first\XESPD@default@style@other\else
    \XESPDthisStyle{\XESPD@default@style@first}%
  \fi}

\newcommand{\XESPDdefaultTitleStyle}[1]{%
  \renewcommand{\XESPD@default@style@title}{#1}}
\newcommand{\XESPDdefaultFirstStyle}[1]{%
  \renewcommand{\XESPD@default@style@first}{#1}}
\newcommand{\XESPDdefaultStyle}[1]{%
  \renewcommand{\XESPD@default@style@other}{#1}%
  \XESPDstyle{#1}}

\newcommand{\XESPDsetPadding}[2]{%
  \changepage{%
    2\XESPD@curpad@v-#2-#2}{%
    2\XESPD@curpad@h-#1-#1}{%
    #1-\XESPD@curpad@h}{%
    #1-\XESPD@curpad@h}{}{%
    #2-\XESPD@curpad@v}{}{}{}
  \setlength{\XESPD@curpad@h}{#1}
  \setlength{\XESPD@curpad@v}{#2}
  \edef\XESPD@tmpcmda{\XESPD@thisstyle}
  \ifx\XESPD@tmpcmda\@empty\else
    \XESPDthisStyle{\XESPD@tmpcmda}
  \fi}

\newenvironment{XESPDpadding}[2]{%
  \newpage\XESPDsetPadding{#1}{#2}}{%
  \clearpage\XESPDsetPadding{\XESPD@padding@h}{\XESPD@padding@v}}

\newenvironment{XESPDzeroPadding}{%
  \begin{XESPDpadding}{0mm}{0mm}}{\end{XESPDpadding}}

\RequirePackage{xespdinfo}

\newcommand{\XESPDtheColumnI}{\XESPDtheTitle\par\XESPDtheDocName}
\newcommand{\XESPDcolumnI}[1]{\renewcommand{\XESPDtheColumnI}{#1}}
\newcommand{\XESPDtheColumnII}{\XESPDtheSignature}
\newcommand{\XESPDcolumnII}[1]{\renewcommand{\XESPDtheColumnII}{#1}}
\newcommand{\XESPDtheColumnIII}{\XESPDtheMaterial}
\newcommand{\XESPDcolumnIII}[1]{\renewcommand{\XESPDtheColumnIII}{#1}}
\newcommand{\XESPDtheColumnIVfI}{\XESPDtheLetterI}
\newcommand{\XESPDcolumnIVfI}[1]{\renewcommand{\XESPDtheColumnIVfI}{#1}}
\newcommand{\XESPDtheColumnIVfII}{\XESPDtheLetterII}
\newcommand{\XESPDcolumnIVfII}[1]{\renewcommand{\XESPDtheColumnIVfII}{#1}}
\newcommand{\XESPDtheColumnIVfIII}{\XESPDtheLetterIII}
\newcommand{\XESPDcolumnIVfIII}[1]{\renewcommand{\XESPDtheColumnIVfIII}{#1}}
\newcommand{\XESPDtheColumnV}{\XESPDtheMass}
\newcommand{\XESPDcolumnV}[1]{\renewcommand{\XESPDtheColumnV}{#1}}
\newcommand{\XESPDtheColumnVI}{\XESPDtheScale}
\newcommand{\XESPDcolumnVI}[1]{\renewcommand{\XESPDtheColumnVI}{#1}}
\newcommand{\XESPDtheColumnIX}{\XESPDtheGroup}
\newcommand{\XESPDcolumnIX}[1]{\renewcommand{\XESPDtheColumnIX}{#1}}
\newcommand{\XESPDtheColumnXIfI}{\XESPDtheAuthor}
\newcommand{\XESPDcolumnXIfI}[1]{\renewcommand{\XESPDtheColumnXIfI}{#1}}
\newcommand{\XESPDtheColumnXIfII}{\XESPDtheChecker}
\newcommand{\XESPDcolumnXIfII}[1]{\renewcommand{\XESPDtheColumnXIfII}{#1}}
\newcommand{\XESPDtheColumnXIfIII}{}
\newcommand{\XESPDcolumnXIfIII}[1]{\renewcommand{\XESPDtheColumnXIfIII}{#1}}
\newcommand{\XESPDtheColumnXIfIV}{}
\newcommand{\XESPDcolumnXIfIV}[1]{\renewcommand{\XESPDtheColumnXIfIV}{#1}}
\newcommand{\XESPDtheColumnXIfV}{\XESPDtheNormContr}
\newcommand{\XESPDcolumnXIfV}[1]{\renewcommand{\XESPDtheColumnXIfV}{#1}}
\newcommand{\XESPDtheColumnXIfVI}{\XESPDtheApprovedBy}
\newcommand{\XESPDcolumnXIfVI}[1]{\renewcommand{\XESPDtheColumnXIfVI}{#1}}
\newcommand{\XESPDtheColumnXIX}{}
\newcommand{\XESPDcolumnXIX}[1]{\renewcommand{\XESPDtheColumnXIX}{#1}}
\newcommand{\XESPDtheColumnXXI}{}
\newcommand{\XESPDcolumnXXI}[1]{\renewcommand{\XESPDtheColumnXXI}{#1}}
\newcommand{\XESPDtheColumnXXII}{}
\newcommand{\XESPDcolumnXXII}[1]{\renewcommand{\XESPDtheColumnXXII}{#1}}
\newcommand{\XESPDtheColumnXXIV}{}
\newcommand{\XESPDcolumnXXIV}[1]{\renewcommand{\XESPDtheColumnXXIV}{#1}}
\newcommand{\XESPDtheColumnXXV}{}
\newcommand{\XESPDcolumnXXV}[1]{\renewcommand{\XESPDtheColumnXXV}{#1}}
\newcommand{\XESPDtheColumnXXVII}{}
\newcommand{\XESPDcolumnXXVII}[1]{\renewcommand{\XESPDtheColumnXXVII}{#1}}
\newcommand{\XESPDtheColumnXXVIII}{}
\newcommand{\XESPDcolumnXXVIII}[1]{\renewcommand{\XESPDtheColumnXXVIII}{#1}}
\newcommand{\XESPDtheColumnXXIX}{}
\newcommand{\XESPDcolumnXXIX}[1]{\renewcommand{\XESPDtheColumnXXIX}{#1}}
\newcommand{\XESPDtheColumnXXX}{}
\newcommand{\XESPDcolumnXXX}[1]{\renewcommand{\XESPDtheColumnXXX}{#1}}
\newcommand{\XESPDtheColumnXXXII}{\@nameuse{XESPD\XESPD@paper FormatName}}
\newcommand{\XESPDcolumnXXXII}[1]{\renewcommand{\XESPDtheColumnXXXII}{#1}}
\newcommand{\XESPDtheColumnXXXIV}{}
\newcommand{\XESPDcolumnXXXIV}[1]{\renewcommand{\XESPDtheColumnXXXIV}{#1}}

