\definecolor{myblue}{rgb}{.8, .8, 1}
\usepackage{empheq}

\newlength\mytemplen
\newsavebox\mytempbox

\makeatletter
\newcommand\mybluebox{%
    \@ifnextchar[%]
       {\@mybluebox}%
       {\@mybluebox[0pt]}}

\def\@mybluebox[#1]{%
    \@ifnextchar[%]
       {\@@mybluebox[#1]}%
       {\@@mybluebox[#1][0pt]}}

\def\@@mybluebox[#1][#2]#3{
    \sbox\mytempbox{#3}%
    \mytemplen\ht\mytempbox
    \advance\mytemplen #1\relax
    \ht\mytempbox\mytemplen
    \mytemplen\dp\mytempbox
    \advance\mytemplen #2\relax
    \dp\mytempbox\mytemplen
    \colorbox{myblue}{\hspace{1em}\usebox{\mytempbox}\hspace{1em}}}
    
    
\newcommand\Switch{0}
\newcommand\SecInHead{%
  \ifthenelse{\equal{\Switch}{1}}
    {\thesection.}{}}
\newcommand\SubSecInHead{%
  \ifthenelse{\equal{\Switch}{1}}
    {\thesubsection. }{}}
\newcommand\RealSubSecInHead{%
  \ifthenelse{\equal{\thesubsection}{0}}
    {}{\SecInHead\SubSecInHead}}

\setbeamertemplate{headline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{section in head/foot}%
  \usebeamerfont{section in head/foot}\SecInHead\ \insertsectionhead\hspace*{2ex}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,left]{subsection in head/foot}%
  \usebeamerfont{subsection in head/foot}\hspace*{2ex}\RealSubSecInHead\insertsubsectionhead
  \end{beamercolorbox}}%
  \vskip0pt%
}

\makeatletter 
  \renewcommand\verbatim@font{\normalfont\ttfamily\color{Sepia}}
\makeatother


\makeatletter
    \newenvironment{withoutheadline}{
        \setbeamertemplate{headline}[default]
        \def\beamer@entrycode{\vspace*{-\headheight}}
    }{}
\makeatother

\newcommand{\bottom}{\vskip0pt plus 1filll}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}



\makeatletter
\setbeamertemplate{footline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor
    %~~\beamer@ifempty{\insertshortinstitute}{}{(\insertshortinstitute)}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertshorttitle
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot} Page {~~}
   \insertframenumber {~~~~~~~~~~~~~~} %/
%   
%       \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em} page
%      \insertframenumber {~~~~} %/
%    \inserttotalframenumber\hspace*{2ex} % DELETED
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatother


