/** OKNA **********************************************************************/

// PUVODNI - KO pri blokovani v MSIE
// function okno(adr)   { window.open(adr.href,'', ''); return false;  }
// NOVA    - OK a to i bez zmeny kodu odkazu
function okno(adr)  { return !window.open(adr.href,'', ''); }

/******************************************************************************/
/*
if (top.location.href!=self.location.href)
{document.write("<style type=\"text\/css\">body { border-top: 4px dashed black; } <\/style>");}
*/
/******************************************************************************/

function init() 
{
  var ahr=document.getElementsByTagName('a'); 
  var cestaa = new String(self.location.href);
  cestaa = cestaa.substring(cestaa.lastIndexOf("\/")+1,cestaa.length);
  for(i=0; i<ahr.length; i++) 
  { 
    var cestab = new String(ahr[i].getAttribute('href'));
    cestab = cestab.substring(cestab.lastIndexOf("\/")+1,cestab.length);
    if(cestaa==cestab)
    { 
      ahr[i].className='actual'; // ahr[i].setAttribute("class","actual"); // nefunguje v MSIE
    }
  } 
}

window.onload = init;

/******************************************************************************/

function sendmailcheck()    // kontrola pro odeslani formulare v zapati
{
if((document.forms[document.forms.length-1].komentar.value=="")||(document.forms[document.forms.length-1].komentar.value==null))
  {
  alert("Pole \"Komentar\" není vyplněno - nelze pokračovat v odeslání!");    
  document.forms[document.forms.length-1].komentar.focus();	    
  document.forms[document.forms.length-1].komentar.select();	    
  return false; 
  }
/*
else
  {
  var nahled="Budou odeslána následující data\n\n";
  nahled+="Jmeno:\t"+document.sendmail.Jmeno.value+"\n";
  nahled+="E-mail:\t"+document.sendmail.Email.value+"\n";
  nahled+="Web:\t"+document.sendmail.Web.value+"\n";
  nahled+="Komentář:\n"+document.sendmail.Komentar.value+"\n";
  if(confirm(nahled)) {  return true; }
  else {  return false; }
  }
*/
}

/*************************************************************/
function kontrola2(obj2,popis2,typ2)
{
  for(var i=0;i<typ2.length;i++) { if(!kontrola(obj2,popis2,typ2.charAt(i))) { return false; }}
  return true; 
}

/*************************************************************/
function kontrola(obj,popis,typ)
{
  //kladne cele i desetinne cislo a 0													///if(typ=="a") { var re = /^[0-9]+([.,]{1}[0-9]{1,})?$/;  }		//(desetinna tecka i carka)
  if(typ=="a") { var re = /^[0-9]+([.,]{1}[0-9]*[1-9]+[0-9]*)?$/;  }		

  //kladne cele i desetinne cislo a zlomek kladneho cele i desetinne cislo (desetinna tecka i carka)					///  if(typ=="b") { var re = /^[0-9]+([.,]{1}[0-9]{1,})?(\/[1-9]{1,}([.,]{1}[0-9]{1,})?)?$/;  }  ////if(typ=="b") { var re = /^[0-9]+([.,]{1}[0-9]{1,})?(\/[1-9]{1}[0-9]*([.,]{1}[0-9]{1,})?)?$/;  }
  if(typ=="b") { var re = /^[0-9]+([.,]{1}[0-9]*[1-9]+[0-9]*)?(\/([0-9]+[.,]{1}[0-9]*)?[1-9]+[0-9]*)?$/;  }

  //kladne i zaporne cele i desetinne cislo (desetinna tecka i carka)  									///if(typ=="c") { var re = /^[+-]?[0-9]+([.,]{1}[0-9]{1,})?$/;  }  
  if(typ=="c") { var re = /^[+-]?[0-9]+([.,]{1}[0-9]*[1-9]+[0-9]*)?$/;  }

  //nenulove (=kladne cele i desetinne cislo)  												//if(typ=="d") { var re = /[1-9]/;  }	  //if(typ=="d") { var re = /^[1-9]+[0-9]*/;  }	
  if(typ=="d") { var re = /^([0-9]+[.,]{1}[0-9]*)?[0-9]*[1-9]+[0-9]*$/;  }		

  //kladne cele cislo a 0
  if(typ=="e") { var re = /^[0-9]+$/;  }		

  //doplnek k A, E kontrolujici nenulovost
  if(typ=="z") { var re = /[1-9]+/;  }		


  if(re.test(obj.value)) { return true; }  
  else 
  {	
    alert("Pole \""+popis+"\" není správně vyplněno - nelze pokračovat ve zpracování!");    
    obj.focus();	    
    obj.select();	    
    return false; 
  }  
}   

function desetinnacarka(obj)
{
  re = new RegExp(",","g") 
  obj.value = ((obj.value).replace(re, "."));
  return (obj.value);	
}



