function CheckNumEdit (Edit) {
  var S = Edit.value - 0;
  if (Edit.value==0) {return true;}
  else if ((parseInt (S) == NaN)||
      (parseInt (S)+'' != S)){
      alert('patně zadané číslo!');
      Edit.focus();
      Edit.select();
      return false;
  } 
  else {
    Edit.value = parseInt (S); return true;
  }
}

function IsMail(adresa,povinna){
  var hodnota = adresa.value;
  if ((hodnota=="")&&(!povinna)) {return true;}
  re = new RegExp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9]+)*(\.[a-z]{2,3})$");
  if (re.test(hodnota)) {return true;}
  else {
    alert("Chybně vyplněná e-mailová adresa. Zkontrolujte, zda odpovídá formátu 'adresa@server.domena' ");
    adresa.focus();
    adresa.select();
  }  
}
function IsTel(hodn) {
  var hodnota = hodn.value;
  var re = /(^\+[0-9]{11,12})|(^[0-9]{9}$)/;

  if ((hodnota.length=="0")||(re.test(hodnota))) {return true;} 
  else {
       alert("Chybně vyplněné číslo telefonu."); 
       hodn.focus(); 
       hodn.select(); 
  return false;
  } 
}
function IsSIM(hodn) {
  var hodnota = hodn.value;
  var re = /(^\+[0-9]{11,12})/;

  if ((hodnota.length=="0")||(re.test(hodnota))) {return true;} 
  else {
       alert("Chybně vyplněné číslo SIM karty. Zadejte ve tvaru +420xxxxxxxxx"); 
       hodn.focus(); 
       hodn.select(); 
  return false;
  } 
}

function IsDat(hodn) {
  var hodnota = hodn.value;
  var re = /([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})/;
  if ((hodnota.length=="0")||(re.test(hodnota))) {return true;} 
  else {
       alert("Chybně vyplněné datum"); 
       hodn.focus(); 
       hodn.select(); 
  return false;
  } 
}

function settxtedi(sel,ptxt){
  if (sel.value=="0") 
    ptxt.disabled=false;
  else {
    ptxt.value="";
    ptxt.disabled=true;
  }
}

function settxtsend(sel,ptxt){
  if (sel.value=="0") {
    ptxt.disabled=false;
  }
  else
    ptxt.value=sel.options[sel.selectedIndex].text;
    ptxt.disabled=false;
}