function HideInfo(id){
	document.getElementById(id).style.display='none';
}

function winH(){
	/* NN4 a kompatibiln prohlee */
	if (window.innerHeight)
		return window.innerHeight;
	/* MSIE6 v std. reimu - Opera a Mozilla ji usply s window.innerHeight */
	else if (document.documentElement && document.documentElement.clientHeight)
		return document.documentElement.clientHeight;
	/* star MSIE + MSIE6 v quirk reimu */
	else if (document.body && document.body.clientHeight)
		return document.body.clientHeight;
	else
		return null;
}

function winW(){
	/* NN4 a kompatibiln prohlee */
	if (window.innerWidth)
		return window.innerWidth;
	/* MSIE6 v std. reimu - Opera a Mozilla ji usply s window.innerHeight */
	else if (document.documentElement && document.documentElement.clientWidth)
		return document.documentElement.clientWidth;
	/* star MSIE + MSIE6 v quirk reimu */
	else if (document.body && document.body.clientWidth)
		return document.body.clientWidth;
	else
		return null;
}

function Okno(width,height,scrollbars,url){
	posX = (winW()/2)-(width/2);
	posY = (winH()/2)-(height/2);
	add=window.open("popup.php?filename="+url,"add","left="+posX+",top="+posY+",width="+width+",height="+height+",menubar=no,directories=no,toolbar=no,location=no,status=no,scrollbars="+scrollbars+",resizable=yes");
	add.focus();
}

function NewWin(url,name,width,height,scrollbars) {
	posX = (winW()/2)-(width/2);
	posY = (winH()/2)-(height/2);
	add=window.open(url,name,"left="+posX+",top="+posY+",width="+width+",height="+height+",menubar=no,directories=no,toolbar=no,location=no,status=no,scrollbars="+scrollbars+",resizable=yes");
	add.focus();
}

/* --- kontrola osobniho dotazniku pred odeslanim --- */
function checkForm() {
	var chyby = "";
	if (document.getElementById('formular').prijmeni.value == '')
		chyby += "Nevyplnil(a) jste příjmení!\n";
	if (document.getElementById('formular').jmeno.value == '')
		chyby += "Nevyplnil(a) jste jméno!\n";
	if (document.getElementById('formular').ulice.value == '')
		chyby += "Nevyplnil(a) jste ulici!\n";
	if (document.getElementById('formular').mesto.value == '')
		chyby += "Nevyplnil(a) jste město!\n";
	if (!((document.getElementById('formular').psc.value < 100000) && (document.getElementById('formular').psc.value > 9999)))
		chyby += "Vyplnil(a) jste špatně PSČ!\n";
	if (!((document.getElementById('formular').narozen_y.value >= 1920) && (document.getElementById('formular').narozen_y.value <= 2050)))
		chyby += "Zadal(a) jste neplatný formát data narození!\n";
	if (document.getElementById('email').value!="" && !document.getElementById('email').value.match(/^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$/))
		chyby += "Zadali jste neplatný email. Prosím opravte ho nebo nechte tuto položku prázdnou.\n";

	if (chyby != "") {
		alert(chyby);
		return false;
	}
	return true;
}

function zobraz(stranka) {
	var divy = document.getElementById('formular').getElementsByTagName('DIV');
	for (x = 0; x < divy.length; x++) {
		if (divy[x].id == stranka)
			divy[x].className = 'show';
		else
			divy[x].className = 'hide';
	}
}
function onSubmit() {
	if (!checkForm())
		return false;
	var chyby = ""
	if (!document.getElementById('formular').souhlas.checked)
		chyby += "Na konci dokumentu musíte zaštnout, že souhlasíte se zpracováním osobních údajů!\n";
//			if (document.getElementById('email_zasilatreklamy').checked && !document.getElementById('email').value.match(/^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$/))
//				chyby += "Žádáte o zasílání volných pracovních pozic na email, ale nezadali jste platnou emailovou adresu.\n";

	if (chyby != "") {
		alert(chyby);
		return false;
	}
	return true;
}


/* --- kontrola osobniho dotazniku pred odeslanim --- */
/*
function vytvorit()
{
	if (document.getElementById('novapozice').value == '') {
		alert('Musíte napsat název pozice!');
		return false;
	}
	else return true;
}*/

function check()
{
	var err = "";
	if (document.getElementById("nazev").value == "")
		err+="Nezadali jste název.\n";
	if (document.getElementById("nastup").value == "")
		err+="Nezadali jste dobu nástupu.\n";
	if (document.getElementById("plat").value == "")
		err+="Nezadali jste plat.\n";
	if (document.getElementById("popis").value == "")
		err+="Nezadali jste popis.\n";
	if (document.getElementById("pozadavky").value == "")
		err+="Nezadali jste pozadavky.\n";
	if (document.getElementById("kontakt").value == "")
		err+="Nezadali jste kontakt.\n";
	if (err=="")
		return true;
	else {
		alert(err);
		return false;
	}
}

//FUNKCE POUZIVANA V DOTAZNICICH
function smennostChange(stav)
{
	if (stav == 0)
		document.getElementById("smennost_pozn").style.display = "table-row";
	else
		document.getElementById("smennost_pozn").style.display = "none";

}

//Dovoli psat pouze numeriku a backspace

function numbersonly(e){
var unicode=e.charCode? e.charCode : e.keyCode
if (unicode!=8){ 
if (unicode<48||unicode>57) 
return false 
}
}

// Spocita rozdil mezi casem nacteni stranky a jejim odeslani, pokud je cas mensi nez 1 minuta tak vrati false, jinak true


function DiferentTime( start)
{
var endTime = getTime();
var vysledek;
vysledek = endTime - start;
if (vysledek < 60 ) 
{return false;}
else 
{return true;} 

}
