$(document).ready(function() {
		/*
		setTimeout(showPopup, 5000);
		$('#disable_popup').click(function() {
				document.cookie = 'mediasport_page_popup=1; path=/';
				$('#bottom_popup').fadeOut(2000);
				$(this).add('#disable_popup_permanent').add('#bottom_popup_background').fadeOut();

				return false;
			});
		$('#disable_popup_permanent').click(function() {
				var date;
				date = new Date();
				date.setFullYear(date.getFullYear() + 5);

				document.cookie = 'mediasport_page_popup=1; expires=' + date.toUTCString() + '; path=/';
				$('#bottom_popup').fadeOut(2000);
				$(this).add('#disable_popup').add('#bottom_popup_background').fadeOut();

				return false;
			});
		*/
		$('a.lightbox').lightBox(); // Select all links with lightbox class
	});


function showPopup(){

	if(document.cookie.indexOf('mediasport_page_popup=1') === -1) {
		var bg;
		bg = document.getElementById('bottom_popup_background');
		bg.style.width = getWindowWidth() + 'px';
		bg.style.height = getWindowHeight() + 'px';
		$('#bottom_popup').fadeIn(2000, function() {
				$('#disable_popup_permanent, #disable_popup', this).fadeIn();
			});
	}
}


/* *****************************************************************************
vrati sirku okna prohlizece
function by pixy http://www.pixy.cz

@param    [win = window]
@return   vrati sirku okna prohlizece nebo null pokud sirka nebyla zjistena
***************************************************************************** */
function getWindowWidth(win) {
	 win = win || window;

	 if (win.innerWidth)
			/* NN4 a kompatibilni prohlizece */
			return win.innerWidth;
	 else if(win.document.documentElement && win.document.documentElement.clientWidth)
			/* MSIE6 v std. rezimu - Opera a Mozilla jiz uspely s window.innerHeight */
			return win.document.documentElement.clientWidth;
	 else if(win.document.body && win.document.body.clientWidth)
			/* stare MSIE + MSIE6 v quirk rezimu */
			return win.document.body.clientWidth;
	 else
			return null;
}


/**
 * Get window height
 * function by pixy http://www.pixy.cz
 * @param  win window object. If not set, actual window is used. Optional
 * @return int heigth of the window
 */
function getWindowHeight(win) {
	win = win || window;

	 if (win.innerHeight)
			/* NN4 a kompatibilni prohlizece */
			return win.innerHeight;
	 else if(win.document.documentElement && win.document.documentElement.clientHeight)
			/* MSIE6 v std. rezimu - Opera a Mozilla jiz uspely s window.innerHeight */
			return win.document.documentElement.clientHeight;
	 else if(win.document.body && win.document.body.clientHeight)
			/* stare MSIE + MSIE6 v quirk rezimu */
			return win.document.body.clientHeight;
	 else
			return null;
}

