function validate(formular)
{
	
	if (formular.email.value=="")
    {
        alert("E-mail nebyl zadán!");
        formular.email.focus();
        return false;
    }
	else if (window.RegExp)
    {
        re = new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$");
        if (!re.test(formular.email.value))
        {
            alert("Zadaný e-mail je ve špatném tvaru!");
            formular.email.focus();
            return false;
        }
    }
    else 
        return true;
}

function neprazdneHledani(formular){
	
	if (formular.clen.value=="" || formular.clen.value=="Slovo či číslo")
    {
        alert("Nezadali jste, co chcete hledat!");
        formular.clen.focus();
        return false;
    }
    else 
        return true;
}
/*
function kontrolaKomentare2(formular){
	
	if (formular.jmeno.value=="" || formular.jmeno.value=="Jméno *" || formular.jmeno.value==" "){
        alert("Zadejte, prosím, vaše jméno");
        formular.jmeno.focus();
        return false;
 }else{
 
      if (formular.nadpis.value=="" || formular.nadpis.value=="Nadpis *" || formular.nadpis.value==" "){
        alert("Zadejte, prosím, nadpis komentáře");
        formular.nadpis.focus();
        return false;
              
      }else{
      
            
    if (formular.komentar.value=="" || formular.komentar.value=="Váš komentář *" || formular.komentar.value==" "){
        alert("Zadejte, prosím, text vašeho komentáře");
        formular.komentar.focus();
        return false;}
            else{
                return true;
                }  
         
      }
    }

}

*/

function helpOkno() {
window.open("","okno","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=300,height=580,resizable=1,left=15,top=20");

}

function fotkuDoOkna() {
window.open("","p",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=770,height=660,resizable=1,left=200,top=20');
}  

function kontrolaKomFoto(formular)
{
	
	if (formular.jmeno.value=="" || formular.jmeno.value=="Jméno" || formular.jmeno.value==" "){
        alert("Prosím, zadejte Vaše jméno či přezdívku...");
        formular.jmeno.focus();
        return false;
    }
    else{      
      if (formular.komentar.value=="" || formular.komentar.value=="Váš komentář"){
              alert("Prosím, zadejte komentář...");
              formular.komentar.focus();
              return false;
      } else{ 
           
           
           
           if (formular.email.value!="" && formular.email.value!="E-mail" && formular.email.value!=" ")


          {
            if (window.RegExp){
              re = new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$");
              
                  if (!re.test(formular.email.value))
                    {
                      alert("Zadaný e-mail je ve špatném tvaru!");
                      formular.email.focus();
                      return false;
                    }
            }
          }else{ 
                  return true;
                }
        
        
        
        
        
        }
    }
}    


function kontrolaKomentare(formular){

	if (formular.jmeno.value=="" || formular.jmeno.value=="Jméno *" || formular.jmeno.value==" "){
        alert("Zadejte, prosím, Vaše jméno či přezdívku...");
        formular.jmeno.focus();
        return false;
    }
    else {//ok      
if (formular.nadpis.value==""||formular.nadpis.value=="Nadpis *"){//ok
              alert("Zadejte, prosím, nadpis komentáře...");
              formular.nadpis.focus();
              return false;
      }else {//ok 
           
           
           
           if (formular.email.value!="" && formular.email.value!="E-mail" && formular.email.value!=" "){//ok
            if (window.RegExp){
              re = new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$");
              
                  if (!re.test(formular.email.value))
                    {
                      alert("Zadaný e-mail je ve špatném tvaru!");
                      formular.email.focus();
                      return false;
                    }
            }
        
        
          }else{//ok
if (formular.komentar.value==""||formular.komentar.value=="Váš komentář *"){
        alert("Zadejte, prosím, komentář...");
        formular.komentar.focus();
        return false;
              
               }else{ 
                     return true;
                    }//ok
        
        }//ok
        
  
    }//ok
   
   }//ok
    
}    


function helpOkno(sirka,vyska) {

window.open("","okno","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width="+sirka+",height="+vyska+",resizable=1,left=0,top=0");


}

function kontrolaEditProfil(formular){

	if (formular.jmeno.value=="")
	{
		alert("Zadejte, prosím, vaše jméno.");
		formular.jmeno.focus();
		return false;
	}
	else if (formular.prijmeni.value=="")
	{
		alert("Zadejte, prosím, vaše příjmení.");
		formular.prijmeni.focus();
		return false;
	}
	else if (formular.prezdivka_nova.value=="")
	{
		alert("Zadejte, prosím, vaši přezdívku (login).");
		formular.prezdivka_nova.focus();
		return false;
	}
	else if (formular.heslo.value=="")
	{
		alert("Zadejte, prosím, vaše heslo.");
		formular.heslo.focus();
		return false;
	}
	else if (formular.reheslo.value=="")
	{
		alert("Potvrďte, prosím, vaše heslo.");
		formular.reheslo.focus();
		return false;
	}
	else if (!(formular.heslo.value==formular.reheslo.value))
	{
		alert("Hesla nejsou stejná.");
		formular.heslo.focus()&&formular.reheslo.focus();
		return false;
	}
	/*else if (window.RegExp)
	{
		re = new RegExp("^[^@]+@[^.]+\..+$");
		if (!re.test(formular.email.value))
		{
			alert ("Zadaná adresa není správnou adresou elektronické pošty!");
			formular.email.focus();
			return false;
		}
	}*/
else if (!(jeCislo(formular.kolikvypsat.value)))
	{
		alert("Počet příspěvků na stránku není kladné číslo.");
		formular.kolikvypsat.focus();
		return false;
	}else if (formular.kolikvypsat.value>100 || formular.kolikvypsat.value<1)
	{
		alert("Počet příspěvků na stránku je mimo interval 1-100!");
		formular.kolikvypsat.focus();
		return false;
	}else
	return true;
	
}

function jeCislo(text){
 var cislo = false;
  if (((text.charAt(0)=="1") ||
      (text.charAt(0)=="2") ||
      (text.charAt(0)=="3") ||
      (text.charAt(0)=="4") ||
      (text.charAt(0)=="5") ||
      (text.charAt(0)=="6") ||
      (text.charAt(0)=="7") ||
      (text.charAt(0)=="8") ||
      (text.charAt(0)=="9")) && 
   
      ((text.charAt(1)=="") ||
      (text.charAt(1)=="0") ||
      (text.charAt(1)=="1") ||
      (text.charAt(1)=="2") ||
      (text.charAt(1)=="3") ||
      (text.charAt(1)=="4") ||
      (text.charAt(1)=="5") ||
      (text.charAt(1)=="6") ||
      (text.charAt(1)=="7") ||
      (text.charAt(1)=="8") ||
      (text.charAt(1)=="9"))) {cislo = true;}
 
 return cislo;

}

function setClass(id,cls) {
  document.getElementById(id).className=cls;
}

function unsetClass(id,cls) {
  document.getElementById(id).className=cls;
}

function prihlaseno(stav){

	if (stav=="ano"){
        alert("Přihlášení proběhlo úspěšně!");
  }else{
        alert("Přihlášení se nezdařilo!");
  }
}


function hlasovano(stav){

	if (stav=="ano"){
        alert("Hlasování proběhlo úspěšně!");
  }else{
        alert("Hlasování se nezdařilo!");
  }
}

function popup_image(img){
  nw = window.open("","nw","status=no,menubar=no,directories=no,location=no,scrollbars=auto,resizable=yes,left=50,top=50,toolbar=0");

  with(nw.document){
    open();
    writeln("<html>");
    writeln("<head><title>www.hfczlin.cz - detail fotky</title>\n");
    writeln("<script language='JavaScript'>");
    writeln("<!--\n");
    writeln("function uprav_rozmery_okna()\n{");
    writeln(" img = document.getElementById('obr');");
    writeln(" w_width = img.width + 40; w_height = img.height + 110;");
    writeln(" window.resizeTo(w_width,w_height);");
    writeln("}\n\n//-->");
    writeln("</scr"+"i"+"pt></head>\n");
    writeln("<body style='background: #FDFF5B;margin:3px auto;text-align:center;' topmargin='0' leftmargin='0' align='center' onload='uprav_rozmery_okna()'>");
    writeln("<div style='margin: 8px auto;padding:5px;align: center;border: 1px solid #364E7C;'><a href='#' onclick='window.close();' title='Zavřít okno' style='color:#364E7C;'><img border='0' src='"+img+"' id='obr' /><br /><div style='font-family:verdana;font-size:11px;margin:0 auto;color:#364E7C;'>zavřít okno</div></a></div>");
    writeln("</bo"+"d"+"y></ht"+"m"+"l>");
    close();
  }
  nw.focus();
}

