\ProvidesPackage{beamerthemeAILAB}

\mode<all>

\definecolor{TitleBG}{RGB}{64,64,64}
\definecolor{FRIRed}{RGB}{192,65,49}
\definecolor{tlg}{RGB}{230,230,230}
\definecolor{navyblue}{RGB}{0,0,128}
\definecolor{textcolor}{RGB}{85,85,85}
\definecolor{abstract}{RGB}{66,116,165}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%It seems many of the following entries do not control any visible Behaviour. All such entries are
%set to red, so that they are easy to spot if they ever become visible

\setbeamercolor{headline}{fg=red,bg=TitleBG} 
\setbeamercolor{footline}{fg=red, bg=red}
\setbeamerfont{footline}{size=\large,series=\bf}
\setbeamercolor{separation line}{bg=TitleBG}
\setbeamercolor{title in headline}{fg=white}
\setbeamercolor{author in headline}{fg=white}
\setbeamercolor{institute in headline}{fg=white}

\setbeamercolor{framesubtitle}{fg=red, bg=red}
\setbeamercolor{author in head/foot}{fg=white, bg=TitleBG}
\setbeamercolor{title in head/foot}{fg=red, bg=red}

\setbeamercolor*{normal text}{fg=textcolor, bg=tlg}
\setbeamercolor*{block body}{fg=black, bg=white}
\setbeamercolor*{block title}{fg=black,bg=tlg}
\setbeamerfont{block title}{size=\large,series=\bf}
\setbeamercolor{upper separation line head}{fg=red}

\setbeamercolor*{example body}{fg=red,bg=red}
\setbeamercolor*{example text}{fg=red,bg=red}
\setbeamercolor*{example title}{bg=red,fg=red}

\setbeamercolor{alerted text}{fg=red}
\setbeamercolor{structure}{fg=tlg}

\setbeamertemplate{itemize items}{\color{textcolor}$\blacktriangleright$}

\newenvironment<>{myblock}[1]{%
	\begin{actionenv}#2%
		\def\insertblocktitle{\centering#1}%
		\par%
		\usebeamertemplate{block begin}\leftskip=14pt\rightskip=14pt\vspace{10pt}}
	{\par\vspace{1em}\usebeamertemplate{block end}
\end{actionenv}}

\newenvironment<>{abstractblock}[1]{%
	\begin{actionenv}#2%
		\usebeamertemplate{abstract}\leftskip=14pt\rightskip=14pt\vspace{10pt}}
	{\par\vspace{1em}\usebeamertemplate{block end}
\end{actionenv}}

\setbeamertemplate{abstract}
{
	\vskip.75ex
	{\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
	\usebeamerfont{block body}%
	\begin{beamercolorbox}[leftskip=1em,colsep*=.75ex,sep=0.5ex,vmode]{block body}%
		\ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

\setbeamertemplate{block begin}
{
	\vskip.75ex
	\begin{beamercolorbox}[ht=5ex,dp=0.5ex,center,leftskip=-1em,colsep*=.75ex]{block title}%
		\usebeamerfont*{block title}\centering\large%
		{\phantom{Gg}\insertblocktitle}% phantom because of baseline problem
	\end{beamercolorbox}%

	{\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
	
	\usebeamerfont{block body}%
	\begin{beamercolorbox}[leftskip=1em,colsep*=.75ex,sep=0.5ex,vmode]{block body}%
		\ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

\setbeamertemplate{block end}{
	\end{beamercolorbox}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{headline}{
	\leavevmode
	\begin{beamercolorbox}[wd=\paperwidth]{headline}
		\vspace{2ex}\\
		\begin{columns}[c]
			\begin{column}{.07\paperwidth}
			\end{column}
			\begin{column}{.695\paperwidth}
				\usebeamercolor{title in headline}{\color{fg}\textbf{\LARGE{\inserttitle}}\\[1ex]}
				\usebeamercolor{author in headline}{\color{fg}\large{\insertauthor}\\[1ex]}
				\usebeamercolor{institute in headline}{\color{fg}\small{\insertinstitute}\\[1ex]}
			\end{column}
			\begin{column}{.25\paperwidth}
				\begin{center}
					\includegraphics[width=.8\textwidth, height=.39\textwidth, keepaspectratio]{\inserttitlegraphic}
				\end{center}
			\end{column}
			\begin{column}{.03\paperwidth}
			\end{column}
		\end{columns}
		\vspace{2ex}\\
	\end{beamercolorbox}
	
	\begin{beamercolorbox}[wd=\paperwidth]{lower separation line head}
		\rule{0pt}{2pt}
	\end{beamercolorbox}
	\vskip-2cm
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{footline}{
	\begin{beamercolorbox}[wd=\paperwidth]{upper separation line foot}
		\rule{0pt}{2pt}
	\end{beamercolorbox}
	\leavevmode%
	\begin{beamercolorbox}[ht=4ex,leftskip=1cm,rightskip=1cm]{author in head/foot}%
		\href{\mywebpage}{\mywebpage}
		\hfill
		%		\today
		%		\hfill
		\href{mailto:\myemail}{\myemail}
		\vskip1ex
	\end{beamercolorbox}
	\vskip0pt%
	\begin{beamercolorbox}[wd=\paperwidth]{lower separation line foot}
		\rule{0pt}{2pt}
	\end{beamercolorbox}
}





