\mode<presentation>

\setbeamertemplate{background}{
  \begin{tikzpicture}
  \useasboundingbox (0,0) rectangle(\the\paperwidth,\the\paperheight);

  \fill[color=MITred] (0,\the\paperheight) rectangle (\the\paperwidth,0.97\paperheight); % felső vörös csík

  % címoldal
  \ifnum\thepage=1\relax
  	\node[anchor=south west] at (0.02\paperwidth, 0.05\paperheight) {\includegraphics[width=5cm]{theme_media/mit_logo_szoveggel_raszter.png}}; % MIT-logó
  	\node[anchor=south west] at (\paperwidth - 0.43\paperwidth, 0.05\paperheight) {\includegraphics[width=5cm]{theme_media/bme_logo.pdf}}; % BME-logó
  	\fill[color=MITred] (0,0) rectangle (\the\paperwidth,0.03\paperheight); % elsó vörös csík 
  	\fill[color=gray!20] (0.2\paperwidth,0.23\paperheight) rectangle 
  		++(0.6\paperwidth, 0.005\paperheight); % szürke elválasztó
  \fi
  
  % NEM címoldal
  \ifnum\thepage>1\relax%
    \fill[color=black!20] (0, 0) rectangle (0.105\paperwidth,0.03\paperheight); % alsó csík szürke eleje
    \fill[color=MITred] (0.105\paperwidth,0) rectangle (\the\paperwidth,0.03\paperheight); % alsó vörös csík  % másik változat h=0.075
    \node[anchor=south west] at (0, -0.05) {\includegraphics[height=0.1\paperheight]{theme_media/mit_logo.pdf}}; % MIT logó
%        \node[anchor=south west] at (0.01\paperwidth, 0.03\paperheight) {\includegraphics[height=0.1\paperheight]{theme_media/mit_logo.pdf}};
  \fi
  \end{tikzpicture}
}

% Title page
\defbeamertemplate*{title page}{mit}[1][]
{ 
    \begin{beamercolorbox}[center, wd=\paperwidth]{title page title}
    	\vskip0.2em
    	{\huge \textbf{\inserttitle}\par}
    	\vskip0.9em
    \end{beamercolorbox}%
    %
    \vskip0.5cm%
    \begin{beamercolorbox}[center]{author}
      	\Large \insertauthor\\
      	\vskip0.5em
      	\ifdefined\supervisor
	      	\textcolor{MITgray1}{\large{K}\scriptsize{ONZULENS}}\\
    	  	\supervisor
    	\fi
    \end{beamercolorbox}
	%
    \vskip0.5cm%
    \begin{beamercolorbox}[center]{date}
      	\insertdate%
    \end{beamercolorbox}
  \vfill
}

% dia címe
\defbeamertemplate*{frametitle}{mit}[1][]
{
	\vskip0.025\paperheight
	\begin{beamercolorbox}[wd=\paperwidth, ht=0.1\paperheight, center]{frame title} 
	\parbox[t][0.09\paperheight][c]{\paperwidth}{
		\hskip1em \insertframetitle
	}
	\vskip\fill
	\end{beamercolorbox}
}

% dia lábléce 
\defbeamertemplate*{footline}{mit}[1][]
{
	\begin{beamercolorbox}[wd=\paperwidth,ht=0.1\paperheight]{footer} 
	\parbox[t][0.03\paperheight][c]{\the\paperwidth}{
		\vskip0.01\paperheight
		
		\ifnum\thepage>1
			\hskip0.11\paperwidth BME-MIT \insertdate\ \copyright~\crfootnote
			\hfill  \insertframenumber\hspace{0.3em}
		\fi	
	}
	\vskip0.005\paperheight
	\end{beamercolorbox}
}

% szakaszcím-dia
\setbeamertemplate{section page}
{
	\begin{center}
		\begin{beamercolorbox}[wd=\paperwidth,sep=12pt,center]{part title}
			\usebeamerfont{section title}\thesection\quad\insertsection\par
		\end{beamercolorbox}
	\end{center}
}


\mode<all>