var poc = 0;



function showInfo(imWidth,imHeight,winFile)  
    { 
      if (poc !== 0) { iwin.close(); }; 
     
      url = winFile; 
      resStr = "resizable=0,scrollbars=0";

                                             // define window oversize
      winPlusWidth = 0;
      winPlusHeight = 0;
                                             // calculate window size
      winHeight = imHeight + winPlusHeight;
      winWidth = imWidth + winPlusWidth;
                                             // test if the window is not too large
		heightOK = true;
		
      if (winHeight>screen.availHeight)
        {
         winHeight = screen.availHeight-80;
      	 resStr=",resizable=1,scrollbars=1";
    	 heightOK = false;
      	}
      	
      if (heightOK==false)
        { 
         winWidth = winWidth+22;
      	}	
      								 
      if (winWidth>screen.width)
        { 
          winWidth = screen.width-80;
      	  resStr=",resizable=1,scrollbars=1";
      	}								 

                                                        // calculate centered window position
      winLeft = Math.round((screen.width-winWidth)/2);
      winTop  = Math.round((screen.availHeight-winHeight)/2);

      iwin = window.open(url, "", "left="+winLeft+",top="+winTop+",height="+winHeight+",width="+winWidth+",directories=no,location=no,menubar=no,status=no,toolbar=no,resizable=0,scrollbars=auto");
      
      poc++;
      return true;
    }
    
   
    
    
    
    
    
  //----------------------------------- to same, ale se scrollbarem...  ------------------------------------------------------------------------
    
    
    function showInfo2(imWidth,imHeight,winFile)  
    { 
      if (poc !== 0) { iwin.close(); }; 
     
      url = winFile; 
      resStr = "resizable=0,scrollbars=0";

                                             // define window oversize
      winPlusWidth = 0;
      winPlusHeight = 0;
                                             // calculate window size
      winHeight = imHeight + winPlusHeight;
      winWidth = imWidth + winPlusWidth;
                                             // test if the window is not too large
		heightOK = true;
		
      if (winHeight>screen.availHeight)
        {
         winHeight = screen.availHeight-80;
      	 resStr=",resizable=1,scrollbars=1";
    	 heightOK = false;
      	}
      	
      if (heightOK==false)
        { 
         winWidth = winWidth+22;
      	}	
      								 
      if (winWidth>screen.width)
        { 
          winWidth = screen.width-80;
      	  resStr=",resizable=1,scrollbars=1";
      	}								 

                                                        // calculate centered window position
      winLeft = Math.round((screen.width-winWidth)/2);
      winTop  = Math.round((screen.availHeight-winHeight)/2);

      iwin = window.open(url, "", "left="+winLeft+",top="+winTop+",height="+winHeight+",width="+winWidth+",directories=no,location=no,menubar=no,status=no,toolbar=no,resizable=0,scrollbars=1");
      
      poc++;
      return true;
    } 
    

   
    
//----------------------------------------------------------------------------------------------------------------------------------------
function isNum(passedVal) {
			if (passedVal == "") {
				return false
			}
			for (i=0; i<passedVal.length; i++) {
				if (passedVal.charAt(i) < "0") {
					return false
				}
				if (passedVal.charAt(i) > "9") {
					return false
				}
			}
			return true
		} 


    
     function validEmail(email) {
			invalidChars = " /:,;"
	
			if (email == "") {
				return false
			}
			for (i=0; i < invalidChars.length; i++) {
				badChar = invalidChars.charAt(i)
				if (email.indexOf(badChar,0) > -1) {
					return false
				}
			}
			atPos = email.indexOf("@",1)
			if (atPos == -1) {
				return false
			}
			if (email.indexOf("@",atPos+1) > -1) {
				return false
			}
			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) {
				return false
			}
			if (periodPos+3 > email.length)	{
				return false
			}
			return true
		}
		
		
		
		
		
		function bezdiakEmail(email) {
		
			var sdiak = "áäčďéěíĺľňóôőöŕšťúůűüýřžÁÄČĎÉĚÍĹĽŇÓÔŐÖŔŠŤÚŮŰÜÝŘŽ";
	
		  var spravne = 1;  // 1 = bez diakritiky, 2 = s diakritikou
                                                                                                                                                         
      for(p = 0; p < email.length; p++) { // proverim, jestli v nazvu neni znak s diakritikou...
                                                   
                if(sdiak.indexOf(email.charAt(p)) != -1) {
                                                          spravne = 2;
                                                          break;
                }
                  else continue;                                                   
                                                   
      } // end for
      
      
      if(spravne > 1) return false;
      
        else return true;
      
		} // end function
		
// ==================================================================================




  function checkMailForm() {
  	
  	var chyba = "";
  	
    	
  	if(document.formular.zprava.value=="") chyba = chyba + "- napište text zprávy";
  	if(document.formular.jmeno.value=="") chyba = chyba + "\n\n- uveďte své jméno";
  	if(document.formular.email.value=="") chyba = chyba + "\n\n- uveďte svoji e-mailovou adresu";
  	if( (document.formular.email.value !== "") && (!validEmail(document.formular.email.value)) ) chyba = chyba + "\n\n- uvedená e-mailová adresa není platná";
  	if(document.formular.ikod.value=="") chyba = chyba + "\n\n- přepište kontrolní kód";
  	  	
  	if(chyba !== "") {
  	                 alert(chyba);
  	                 return false;	
  	}
  
  	  else return true;
  }
 
  
  
  
  
  


function checkSearch() {

  if(document.searchform.hledane.value == "")  {
                                                 alert("Zadejte hledný výraz");
                                                 document.searchform.hledane.focus();
                                                 return false;
  }
  
    else if(document.searchform.hledane.value.length < 3) {
                                                           alert("Hledaný výraz musí mít nejméně 3 znaky");
                                                           document.searchform.hledane.select();
                                                           return false;
    }
    
      else return true;

} // end function





function toggle(targetId) {
     	
     	if(document.getElementById) {
         target = document.getElementById(targetId);
           if(target.style.display == "none")  {
             target.style.display = "";
           }
             else {
                  target.style.display = "none";
             }
       }
     	
     } // end function
