function zobrazInfo(){
	document.getElementById('info').style.display="block";
	document.getElementById('pocet').style.display="block";
	document.getElementById('text').style.margin="0em 0em .3em .3em";
	document.getElementById('enter').disabled = "disabled";
}
function pocet(){
        area = document.getElementById('text');
	alength = area.value.length;
	if(alength > 1000){
		area.value = area.value.substr(0,1000);
		document.getElementById('cislo').innerHTML="max";
		document.getElementById('cislo').style.color="red";
	} else {
		document.getElementById('cislo').innerHTML=alength;
		document.getElementById('cislo').style.color="black";
	}
	if(alength >= 1) {
		document.getElementById('enter').disabled = "";
	} else {
		document.getElementById('enter').disabled = "disabled";
	}
	
}
function overPrazdnePole( Pole, Zprava ) {
if( Pole.value =="" ) {
        if(document.getElementById) {
		Upozorneni(Pole,Zprava,"");
        } else {
            	alert(Zprava);
        }
        return false;
    } else {
        return true;
    }
}
function Upozorneni(Pole,Hlaska,puvodniHodnota){
	Pole.style.color="red";
	Pole.value=Hlaska;
	setTimeout("SkryjUpozorneni('"+Pole.name+"','"+puvodniHodnota+"')",100);
}
function SkryjUpozorneni(Pole,puvodniHodnota){
	document.getElementById(Pole).style.color="black";
	document.getElementById(Pole).style.textalign="left";
	document.getElementById(Pole).value=puvodniHodnota;
	document.getElementById(Pole).focus();
}

function overeniFormulare(){
  if(!overPrazdnePole(document.getElementById('jmeno'),"Nutno zadat jméno")) return false;
	if(!overEmail(document.getElementById('email')))return false;
	if(!overPrazdnePole(document.getElementById('text'),"Nutno zadat zprávu")) return false;
	return true;
}

function overEmailovouAdresu(adresa)
{
  var filtr = /^([_a-z0-9+\-][_a-z0-9\.%+\-]*@((?:[a-z0-9\-]+\.)+(?:[a-z]{2,4}|museum)))+$/;
  var vysledek = filtr.test(adresa);
  return (vysledek);
}
function overEmail(txtEmail)
{
  if (txtEmail.value == ""  || txtEmail.value == "vas@existujici.email")
  {
    Upozorneni(txtEmail,"Nutno vyplnit adresu",txtEmail.value);  
    txtEmail.focus();
    return (false);
  }
  if (txtEmail.value.length > 250)
  {
    Upozorneni(txtEmail,"Příliš dlouhá adresa",txtEmail.value);
    txtEmail.focus();
    return (false);
  }
  if (!overEmailovouAdresu(txtEmail.value))
  {
    Upozorneni(txtEmail,"Není platná adresa",txtEmail.value);
    txtEmail.focus();
    return (false);
  }
  return (true);
}

