% True IF_RIGHT_PAGE condition
% (c) Vit Zyka, 2001-09-05

%\makeatletter
\newcount\countifrightpage
\def\initifrightpage{\countifrightpage=0\relax}
\def\defifrightpage#1{\global\advance\countifrightpage by1
  \expandafter\gdef\csname ifrightpage:\the\countifrightpage\endcsname{#1}}
\def\ifrightpage{\global\advance\countifrightpage by1\nobreak
  \write\@mainaux{\string\defifrightpage\string{\thepage\string}}%
  \expandafter\ifx\csname ifrightpage:\the\countifrightpage\endcsname\relax%
    \def\next{\csname iftrue\endcsname}\else%
    \def\next{\csname ifodd\endcsname%
        \csname ifrightpage:\the\countifrightpage\endcsname\relax}%
  \fi\next}
\AtBeginDocument{\initifrightpage}
\AtEndDocument{\initifrightpage}
%\makeatother

\endinput

%% Tests:

\documentclass{article}
%\usepackage{ifrpage}

\def\?{\ifrightpage Right\message{ <R> }\else Left\message{ <L> }\fi\ }

\begin{document}
  Test 1: \? \? \newpage
  Test 2: \? \? \newpage
  Test 3: \? \? \newpage
\end{document}
