




function klientOverMail(mail)
{
     
     
     
     
     var url = '/ajax_scripty/over_mail_pro_prihlaseni.php?mail='+mail;

     
        if (window.ActiveXObject)
        {
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else
        {
          httpRequest = new XMLHttpRequest();
        }
        httpRequest.open("GET", url, true);
        httpRequest.onreadystatechange= function () {processRequest(); } ;
        httpRequest.send(null);
     
}




function processRequest()
{
  if (httpRequest.readyState == 4)
  {
    if(httpRequest.status == 200)
    {
     // var mistoZobrazeni = document.getElementById("zobrazmail");
     // mistoZobrazeni.innerHTML = httpRequest.responseText;
     
     if (httpRequest.responseText == "1") {
        document.getElementById('heslo1').style.display="block";
        document.getElementById('heslo2').style.display="block";
        document.getElementById('overenyMail').value="1";
        
        
        
     } else {
     
        document.getElementById('heslo1').style.display="none";
        document.getElementById('heslo2').style.display="none";
        document.getElementById('overenyMail').value="";
        
     } 
     
      
    }
    
  }  
}



function vlozDodaciAdresu(id_adresa) {
  
  var vlozit_jmeno;
  var vlozit_ulice;
  var vlozit_mesto;
  var vlozit_psc;
  var vlozit_ico;
  var vlozit_dic;
  var vlozit_firma;
  
  if (id_adresa) {
     
     vlozit_jmeno = document.getElementById('dodaciJmeno_'+id_adresa).value;
     vlozit_ulice = document.getElementById('dodaciUlice_'+id_adresa).value;
     vlozit_mesto = document.getElementById('dodaciMesto_'+id_adresa).value;
     vlozit_psc   = document.getElementById('dodaciPSC_'+id_adresa).value;
     vlozit_ico   = document.getElementById('dodaciICO_'+id_adresa).value;
     vlozit_dic   = document.getElementById('dodaciDIC_'+id_adresa).value;
     vlozit_firma = document.getElementById('dodaciFirma_'+id_adresa).value;
  
  } else {
    vlozit_jmeno = '';
    vlozit_ulice = '';
    vlozit_mesto = '';
    vlozit_psc = '';
    vlozit_ico = '';
    vlozit_dic = '';
    vlozit_firma = '';
  
  }
  
     
     document.getElementById('dodaciJmeno').value = vlozit_jmeno;
     document.getElementById('dodaciUlice').value = vlozit_ulice;
     document.getElementById('dodaciMesto').value = vlozit_mesto;
     document.getElementById('dodaciPSC').value = vlozit_psc;
     //if (document.getElementById('dodaciICO').value == '') document.getElementById('dodaciICO').value = vlozit_ico;
     //if (document.getElementById('dodaciDIC').value == '') document.getElementById('dodaciDIC').value = vlozit_dic;
     //if (document.getElementById('dodaciFirma').value == '') document.getElementById('dodaciFirma').value = vlozit_firma;
     
     document.getElementById('dodaciICO').value = vlozit_ico;
     document.getElementById('dodaciDIC').value = vlozit_dic;
     document.getElementById('dodaciFirma').value = vlozit_firma;
     
     
     
     if ((vlozit_dic != '') || (vlozit_ico != '') || (vlozit_firma != '')){
        document.getElementById('nafirmu').style.display="block";
        document.getElementById('naFirmuCheck').checked=true;
        
        
        
        }
     if ((vlozit_dic=='') && (vlozit_ico=='') && (vlozit_firma=='')) {
        document.getElementById('nafirmu').style.display="none";
        document.getElementById('naFirmuCheck').checked=false;
        }
  
  

}



function vlozFakturacniAdresu(id_adresa) {
  
  var vlozit_jmeno;
  var vlozit_ulice;
  var vlozit_mesto;
  var vlozit_psc;
  var vlozit_ico;
  var vlozit_dic;
  var vlozit_firma;
  
  if (id_adresa) {
     
     vlozit_jmeno = document.getElementById('fakturacniJmeno_'+id_adresa).value;
     vlozit_ulice = document.getElementById('fakturacniUlice_'+id_adresa).value;
     vlozit_mesto = document.getElementById('fakturacniMesto_'+id_adresa).value;
     vlozit_psc   = document.getElementById('fakturacniPSC_'+id_adresa).value;
     vlozit_ico   = document.getElementById('dodaciICO_'+id_adresa).value;
     vlozit_dic   = document.getElementById('dodaciDIC_'+id_adresa).value;
     vlozit_firma = document.getElementById('dodaciFirma_'+id_adresa).value;
  
  } else {
    vlozit_jmeno = '';
    vlozit_ulice = '';
    vlozit_mesto = '';
    vlozit_psc = '';
    vlozit_ico = '';
    vlozit_dic = '';
    vlozit_firma = '';
  
  }
  
     
     document.getElementById('fakturacniJmeno').value = vlozit_jmeno;
     document.getElementById('fakturacniUlice').value = vlozit_ulice;
     document.getElementById('fakturacniMesto').value = vlozit_mesto;
     document.getElementById('fakturacniPSC').value = vlozit_psc;
     
     if (vlozit_ico != '') document.getElementById('dodaciICO').value = vlozit_ico;
     if (vlozit_dic != '') document.getElementById('dodaciDIC').value = vlozit_dic;
     if (vlozit_firma != '') document.getElementById('dodaciFirma').value = vlozit_firma;
     
     
     
     if ((vlozit_dic != '') || (vlozit_ico != '') || (vlozit_firma != '')){
        document.getElementById('nafirmu').style.display="block";
        document.getElementById('naFirmuCheck').checked=true;
        
        
        
        }
     
     
     
    
  
  

}

 
function vlozDodaciAdresuKlient(id_adresa) {
  
  var vlozit_jmeno;
  var vlozit_ulice;
  var vlozit_mesto;
  var vlozit_psc;
  var vlozit_ico;
  var vlozit_dic;
  var vlozit_firma;
  
  if (id_adresa) {
     
     vlozit_jmeno = document.getElementById('dodaciJmeno_'+id_adresa).value;
     vlozit_ulice = document.getElementById('dodaciUlice_'+id_adresa).value;
     vlozit_mesto = document.getElementById('dodaciMesto_'+id_adresa).value;
     vlozit_psc   = document.getElementById('dodaciPSC_'+id_adresa).value;
     vlozit_ico   = document.getElementById('dodaciICO_'+id_adresa).value;
     vlozit_dic   = document.getElementById('dodaciDIC_'+id_adresa).value;
     vlozit_firma = document.getElementById('dodaciFirma_'+id_adresa).value;
  
  } else {
    vlozit_jmeno = '';
    vlozit_ulice = '';
    vlozit_mesto = '';
    vlozit_psc = '';
    vlozit_ico = '';
    vlozit_dic = '';
    vlozit_firma = '';
  
  }
  
     
     document.getElementById('dodaciJmeno').value = vlozit_jmeno;
     document.getElementById('dodaciUlice').value = vlozit_ulice;
     document.getElementById('dodaciMesto').value = vlozit_mesto;
     document.getElementById('dodaciPSC').value = vlozit_psc;
     document.getElementById('dodaciICO').value = vlozit_ico;
     document.getElementById('dodaciDIC').value = vlozit_dic;
     document.getElementById('dodaciFirma').value = vlozit_firma;
     document.getElementById('IDadresa').value = id_adresa;
     
     if (id_adresa != '') {
        document.getElementById('ulozit_adresu').style.display="block";
        document.getElementById('nova_adresa').style.display="none";
        document.getElementById('buttonSmazat').style.display="inline";
        
        } else {
        
           document.getElementById('ulozit_adresu').style.display="none";
           document.getElementById('nova_adresa').style.display="block";
           document.getElementById('buttonSmazat').style.display="none";
        }
     
  

}



function saveCon(relace) {

  var kontaktni_mail;
  var kontaktni_jmeno;
  var kontaktni_telefon;
  
  
  
  
     
     kontaktni_mail = document.getElementById('mail').value;
     kontaktni_jmeno = document.getElementById('kontaktniJmeno').value;
     kontaktni_telefon = document.getElementById('kontaktniTel').value;
     
     
     if ((kontaktni_jmeno != '')&&(kontaktni_telefon != '')) {
     
       // if (document.getElementById('ulozenoK').value != '1') {
        
            //odesleme a ulozime
                var url = '/ajax_scripty/uloz_zakaznika_pri_zadavani.php?relace='+relace;
                    url = url + '&kontaktniMail='+(kontaktni_mail);
                    url = url + '&kontaktniJmeno='+(kontaktni_jmeno);
                    url = url + '&kontaktniTel='+(kontaktni_telefon);
                    
     
        if (window.ActiveXObject)
        {
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else
        {
          httpRequest = new XMLHttpRequest();
        }
        httpRequest.open("GET", url, true);
        httpRequest.onreadystatechange= function () {processRequest1(); } ;
        httpRequest.send(null);
     
        //}



        
            document.getElementById('ulozenoK').value = '1';
            
            
            
            
            
     } 
     
     
}


function processRequest1()
{
  if (httpRequest.readyState == 4)
  {
    if(httpRequest.status == 200)
    {
     
     
    }
    
  }  
}
     





