function clearPreloadPage() { //DOM
	if (document.getElementById){
		document.getElementById('prepage').style.visibility='visible';
	}else{
		if (document.layers){ //NS4
			document.prepage.visibility = 'visible';
		} else { //IE4
			document.all.prepage.style.visibility = 'visible';
		}
	}
}


function Reload() {
  document.filtr.submit();
}
 
function zChange() {
   dlz = document.fm.zeme;
   dll = document.fm.lokalita;
   v = dlz.options[dlz.selectedIndex].value;
   if (v!=0) a = eval ("z"+v); else a = new Array ();
   l = a.length/2;
   while (l<dll.options.length) dll.options[(dll.options.length-1)]=null;
   dll.options[0]=new Option('- nerozhoduje -',-1,(sel==0),(sel==0));
   for (i=0; i<l; i++) {
     x = i*2;
     dll.options[i+1]=new Option (a[x+1],a[x],(a[x]==sel),(a[x]==sel));
   }
 }

function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function validator(f) {

	if (document.rezervace.celkem.value<=0) {
	  	alert("Počet objednaných zájezdů je nulový.");
	  	return(false);
	  }

	$validate=1;
	if (document.rezervace.prijmeni.value=='' || document.rezervace.ulice.value==''){ $validate=0; }
	if (document.rezervace.telefonbyt.value=='' && document.rezervace.telefonjob.value=='' && document.rezervace.mobil.value=='') {	$validate=0; }
	if (document.rezervace.email.value!='')	{
		if (document.rezervace.email.value.length<7 || !isEmailAddr(document.rezervace.email.value)) {	$validate=0; }
	}
	if ($validate==1)	{	return true; }
	else
	{ alert("Vyplňte, všechny důležité položky:\nKontaktní osoba, kontaktní adresa.\nUveďte také telefon do práce, telefon domů nebo mobil.\nOstatní položky jsou nepovinné.");
	  return(false);
  }

}

function ShowImage(id,adr,name,width,height)
{
	window.open("./inc/pic_nahled.php?id="+id+"&file="+name+"&adr="+adr,"",	"toolbar=no,scrollbars=yes,location=no,status=no,width="+width+",height="+height+",resizable=0,screenX=50,screenY=50");
}

function ShowImageInfo(adr,width,height)
{
	window.open("./inc/pic_nahled_info.php?adr="+adr,"","toolbar=no,scrollbars=yes,location=no,status=no,width="+width+",height="+height+",resizable=0,screenX=50,screenY=50");
}

