//FORMULAR KNIHA HOSTU
function kontrola_kniha(formular)
{ 
  //------------ jmeno ----------------------
  if (formular.jmeno.value=="")
  {
   alert("Jmeno musite vyplnit!");
   formular.jmeno.focus();
   return false;
  }
  //--------------- email ------------
  if (formular.email.value!="")
  {
   if (window.RegExp)
    {
      re = new RegExp("^[^@]+@[^.]+\..+$");
      if (!re.test(formular.email.value))
	  {
	    alert("Zadana adresa neni spravnou adresou elektronicke posty!");
	    formular.email.focus();
        return false;
	  }
    }	  
  }
  //------------------ popis --------------------
  if (formular.popis.value=="")
  {
    alert("Vzkaz musite vyplnit!");
	formular.popis.focus();
	return false;
  }
  //-------------------------------------
    return true;
}

//FORMULAR POSLAT POZADAVEK (napiste nam)
function kontrola_poslat_pozadavek(formular)
{ 	
    //------------ jmeno ----------------------
  if (formular.jmeno.value=="")
  {
   alert("Jméno prosím vyplňte.");
   formular.jmeno.focus();
   return false;
  }
	// ----- kdyz neni ani email ani telefon - musi se vyplnit aspon jeden -------
	if (formular.email.value==""){
		if(formular.telefon.value=="")
		{
			alert("E-mail nebo telefon prosím vyplňte.");
			formular.email.focus();
			return false;
		}
	}
  //--------------- email ------------
  if (formular.email.value!="")
  {
   if (window.RegExp)
    {
      re = new RegExp("^[^@]+@[^.]+\..+$");
      if (!re.test(formular.email.value))
	  {
	    alert("Zadana adresa neni spravnou adresou elektronicke posty!");
	    formular.email.focus();
        return false;
	  }
    }	  
  };

  //------------------ popis --------------------
  if (formular.popis.value=="")
  {
    alert("Vzkaz musite vyplnit!");
	formular.popis.focus();
	return false;
  };

  //-------------------------------------
    return true;
}

//========================funkce pro vertikal menu=========================
var pO = null;
var fo = null;
var d = document;
var hd = 0;
var isMenu = d.getElementById;

function gE(eID)
{
	hd=0;
	return d.getElementById(eID);
}


function hlF(el)
{
	hd=0;
	el.style.cursor="hand";
	if(el.perm==0)
	{
		el.className=el.className.substring(0,el.className.length-1)+"o";
		ed=gE("a"+el.id);
		ac=el.className;
		if(ed!=null)ed.className="a"+ac;
	}
}


function hdF(el)
{
	hd=0;
	el.style.cursor="";
}


function shTree(f)
{
	hd=0;
	f=f.substring(0,f.lastIndexOf("_"));
	while(f.indexOf("_")>0)
	{
		fo=gE(f);
		if(fo!=null)
		{
			hlF(fo);
		}
		f=f.substring(0,f.lastIndexOf("_"));
	}
}

function openMenu(elID, hl){
	if(!isMenu)return;
	hd=0;
	if(pO!=null)
	{
		p1 = pO.id.indexOf("_");
		p2 = pO.id.substring(p1+1);
		e1 = elID.indexOf("_");
		e2 = elID.substring(e1+1);
		if((p2!=e2||pO.id.substring(1,p1)!=elID.substring(1,elID.indexOf("_")))&&p1!=-1&&e2.indexOf("_")==-1)
		{
			hdF(gE("f"+pO.id.substring(1)));
			if(pO.id.indexOf("f")!=0)pO.style.display="none";
			pO=gE(pO.id.substring(0,pO.id.lastIndexOf("_")));
		}
	}
	
	oel=gE(elID);
	hlF(oel);
	melID="m"+elID.substring(1);
	mel=gE(melID);
	shTree(elID);
	
	if(mel!=null)
	{
		with(oel.parentNode.parentNode.parentNode)
		{
			l=offsetLeft;
			t=offsetTop;
		}
		with(oel)
		{
			l+=offsetWidth;
			t+=offsetTop;
			h=offsetHeight;
		}
		cW=d.body.clientWidth;
		with(mel)
		{
			style.display="";
			w=offsetWidth;
			if(hl==0)
			{//vertical
				style.top=t;
				l-=5;
				if((l+w)>cW)
				{
					l=((cW-w-10)<10)?10:(cW-w-10);
					style.top=eval(t+"+"+h)-3;
				}
				style.left=l;
			}
			else
			{//horizontal
				style.top=(t+h);
				l=l-oel.offsetWidth+oel.offsetLeft;
				style.left =((l+w)>cW)?(cW-w-2):l;
			}	
		}
		pO=mel;
	}	
}

//-----------------------------------------
function disMenu(elID)
{
	if(!isMenu)return;
	hd=1;
	del=gE(elID);
	hdF(del);
}


function hideMenu()
{
	if(!isMenu)return;
	if(hd==1&&pO!=null)
	{
		elID=pO.id;
		while(elID.indexOf("_")>0)
		{
			fo=gE(elID);
			hdF(gE("f"+elID.substring(1)));
			if(fo!=null)if(fo.id.indexOf("f")!=0)
			{
				fo.style.display="none";
			}
			elID=elID.substring(0,elID.lastIndexOf("_"));
		}
		pO=fo;
	}
}

function tidyMenu()
{
	if(!isMenu)return;
	hd=1;
	if(pO!=null)setTimeout("hideMenu()",2000);
}

//spusti udalost onclick u odkazu
function navig(elID)
{
	gE("a"+elID).click();
}

//----------------- funkce pro zobrazeni fotek -----------

function ukaz_foto(cis)
{
var element = 'foto'+cis;
if (dom) document.getElementById(element).style.display = 'block';
else if (ie4) document.all[element].style.display = 'block';
}

function zhasni_foto(cis)
{
var element = 'foto'+cis;
if (dom) document.getElementById(element).style.display = 'none';
else if (ie4) document.all[element].style.display = 'none';  
  
}

