/**
	Proměnné pro funkce zobrazení a skrytí Popup okna
*/
var defaultBody = Array();
var defaultTransBack = Array();

/**
		Zobrazí vyskakovací okno
		@params  (String) id  ID vyskakovacího okna
*/
function show_popup(id) {
	defaultBody['height'] = document.getElementById('body').style.height;
	defaultBody['margin'] = document.getElementById('body').style.margin;
	defaultBody['padding'] = document.getElementById('body').style.padding;
	defaultBody['width'] = document.getElementById('body').style.width;
	defaultBody['overflow'] = document.getElementById('body').style.overflow;
	defaultBody['backgroundColor'] = document.getElementById('body').style.backgroundColor;

	defaultTransBack['position'] = document.getElementById(id + 'TransBack').style.position;

	document.getElementById('body').style.height = '100%';
	document.getElementById('body').style.margin = '0px';
	document.getElementById('body').style.padding = '0px';
	document.getElementById('body').style.width = '100%';
	document.getElementById('body').style.backgroundColor = '#FFFFFF';

	if (navigator.appName == 'Microsoft Internet Explorer') {
		document.getElementById('body').style.overflow = 'hidden';
		document.getElementById(id + 'TransBack').style.position = 'absolute';
		document.getElementById(id + 'TransFore').style.position = 'absolute';
	} else {
		document.getElementById('body').style.overflow = 'auto';
		document.getElementById(id + 'TransBack').style.position = 'fixed';
		document.getElementById(id + 'TransFore').style.position = 'fixed';
	}

	document.getElementById(id + 'TransBack').style.display = 'block';
	document.getElementById(id + 'TransFore').style.display = 'block';
}

/**
		Skryje vyskakovací okno
		@params  (String) id  ID vyskakovacího okna
*/
function hide_popup(id) {
	document.getElementById('body').style.height = defaultBody['height'];
	document.getElementById('body').style.margin = defaultBody['margin'];
	document.getElementById('body').style.padding = defaultBody['padding'];
	document.getElementById('body').style.width = defaultBody['width'];
	document.getElementById('body').style.overflow = defaultBody['overflow'];
	document.getElementById('body').style.backgroundColor = defaultBody['backgroundColor'];

	document.getElementById(id + 'TransBack').style.position = defaultTransBack['position'];
	document.getElementById(id + 'TransFore').style.position = defaultTransBack['position'];

	document.getElementById(id + 'TransBack').style.display = 'none';
	document.getElementById(id + 'TransFore').style.display = 'none';

	return true;
}

/**
		Funkce pro skrytí prvku definovaného jeho ID
		@params  (string) idElementu  ID elementu, který chceme skrýt
	*/
function hideElement(idElementu) {
	document.getElementById(idElementu).style.display = 'none';
}

/**
		Funkce pro zobrazení prvku definovaného jeho ID
		@params  (string) idElementu  ID elementu, který chceme zobrazit
	*/
function showElement(idElementu) {
	document.getElementById(idElementu).style.display = 'block';
}

/**
		Funkce pro zakódování řetězce pro jeho přenos v URL
		@params  (String) str  řetězec pro zakódování

		@return  (String)  Zakódovaný řetězec (zpětně dekódovatelné PHP metodou URLDecode() )
	*/
function phpUrlEncode(str) {
	str = encodeURIComponent(str);
	return str.replace(/[*+\/@]|%20/g, function (s) {
			switch (s) {
				case "*": s = "%2A"; break;
				case "+": s = "%2B"; break;
				case "/": s = "%2F"; break;
				case "@": s = "%40"; break;
				case "%20": s = "+"; break;
			}
			return s;
		}
	);
}

/*
	Funkce, která nastaví timer na opakované kontrolování nové otázky v rozhovoru nastavený na počet sekund
	v parametru  opakovat .
*/
function questionCheckerTimer(id_rozhovoru, opakovat) {
	var f = 'questionCheckerTimer('+id_rozhovoru+', '+opakovat+')';

	var id_nejnovejsi_otazky = document.getElementById('div_posledni_otazka_id').innerHTML;
	if ((id_nejnovejsi_otazky * 1) == 0) id_nejnovejsi_otazky = 0;

	questionChecker(id_rozhovoru, id_nejnovejsi_otazky);
	var timer = setTimeout(f, opakovat * 1000);
}

