var obraz=null;
function zvetsi(base,cesta,titul,alt,x,y,jazyk) {
	var sb="no";
	if (x>(screen.width-50)) {
		x=(screen.width-50);
		sb="yes";
	}
	if (y>(screen.height-50)) {
		y=(screen.height-50);
		sb="yes";
	}
	var winl = (screen.width-x)/2;
	var wint = (screen.height-y)/2;
	obraz=window.open("/zvetsi_nav.php?nazev="+titul+"&cesta="+cesta+"&alt="+alt+"&jazyk="+jazyk, "obraz", "width="+(x)+", height="+(y)+", top="+wint+", left="+winl+", menubar=no, directories=no, toolbar=no, location=no, status=no, scrollbars="+sb+", resizable=yes");
	obraz.window.focus();
}
var vokno=null;
function okno(prm, x, y) {
	var sb="yes";
	if (!x) var x=500;
	if (!y) var y=600;
	if (x>(screen.width-100)) {
		x=(screen.width-100);
		sb="yes";
	}
	if (y>(screen.height-100)) {
		y=(screen.height-100);
		sb="yes";
	}
	var winl = (screen.width-x)/2;
	var wint = (screen.height-y)/2;
	vokno=window.open("/okno.php"+prm, "vokno", "width="+(x)+", height="+(y)+", top="+wint+", left="+winl+", menubar=no, directories=no, toolbar=no, location=no, status=no, scrollbars="+sb+", resizable=yes");
	vokno.window.focus();
}

function chtext(prm) {
	var ch = document.getElementById(prm);
	ch.innerHTML="Data budou aktualizována po znovu načtení stránky.";
}

function chboxtd(prm) {
	var ch = document.getElementById(prm);
	if (ch.checked) ch.checked=false;
	else ch.checked=true;
}

function pozor() {
	var ch = document.getElementById("pozor");
	if (!ch) return;
	var winW = document.documentElement.clientWidth;
	var winH = document.documentElement.clientHeight;
	var x = winW/2-100;
	var y = winH/2-150;
	ch.style.width = '200px';
	ch.style.padding = '20px';
	ch.style.border = '5px solid Red';
	ch.style.position = 'absolute';
	ch.style.top = y+'px';
	ch.style.left = x+'px';
	ch.onclick='pozoroff();';
	var zavripozor = setTimeout("pozoroff()", 2500);
}
function pozoroff() {
	var ch = document.getElementById("pozor");
	ch.style.display = 'none';
}
function SearchCheck() {
	var ch = document.getElementById("search");
	if (ch.value.length<2) {
		alert('Pro vyhledávání zadejte alespoň 2 znaky.');
		return false;
	}
}

function OrderFormCheck() {
	var chyby='';
	var pro=document.forms['order'];

	if (pro['contname'].value.length<3) {chyby+='Vyplňte své jméno.\n';pozorpole(pro['contname']);}
	else pohovpole(pro['contname']);
	if (pro['conttel'].value.length<9) {chyby+='Vyplňte svůj telefon.\n';pozorpole(pro['conttel']);}
	else pohovpole(pro['conttel']);

	if (chyby=='') return true;

	alert(chyby);
	return false;
}
function pozorpole(prom) {
 	prom.style.backgroundColor='red';
}
function pohovpole(prom) {
 	prom.style.backgroundColor='#ccffcc';
}
function OrderTable(prm) {
	//var frm=document.forms['order'];
	alert(prm);
}
function OrderTableOn(prm) {
	var ch = document.getElementById(prm);
	ch.style.display='inline';
}
function OrderTableOff(prm) {
	var ch = document.getElementById(prm);
	ch.style.display='none';
}
function sendRequest(data,kam,url,method,mode,header){
    var objhttp=(window.XMLHttpRequest)?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
    if(!objhttp){alert('Vas prohlizec nepodporuje pozadovane funkce.');return;}
    if(!url) url='helper.php';
    if(!data) data='';
    if(!method) method='POST';
    if(!mode) mode=true;
    if(!header) header='Content-Type:application/x-www-form-urlencoded; charset=windows-1250';

    objhttp.open(method,url,mode);
    objhttp.setRequestHeader(header.split(':')[0],header.split(':')[1]);
    objhttp.onreadystatechange=function() {
        if (objhttp.readyState==4 && objhttp.status==200) {
			var back=objhttp.responseText;
			writeContents(back, kam);
		}
    }
    objhttp.send(data);
    //loading();
}
function writeContents(co, kam) {
    if (co) kam.innerHTML=co;
	else kam.innerHTML+="Bohužel, problém s daty.";
	//loadingOff();
}
function loading() {
	var ex=document.getElementById('loading');
	if (!ex) {
		var add = "<img src='/files/loader.gif' width='66' height='66' id='loading' alt='nahrávám..' />";
		document.getElementById('page').innerHTML=add+document.getElementById('page').innerHTML;
		var ex=document.getElementById('loading');
	}
	var winW = document.documentElement.clientWidth;
	var winH = document.documentElement.clientHeight;
	var x = winW/2-33;
	var y = winH/2-33;
	ex.style.display = 'block';
	ex.style.position = 'absolute';
	ex.style.top = y+'px';
	ex.style.left = x+'px';
}
function loadingOff() {
	var ex=document.getElementById('loading');
	ex.style.display = 'none';
}

function uObsah(prm) {
	overlib("<img src='/files/loader.gif' width='66' height='66' id='loading' alt='nahrávám..' />");
	var data="itemlist="+prm;
	var kam=document.getElementById("overDiv");
	sendRequest(data, kam);
}
function sObsah(prm) {
	//setTimeout("nd();", 500);
	nd();
}
if (window.attachEvent) {
	window.attachEvent('onload', pozor);
}
else {
	window.onload = pozor;
}

