function regDepCity(kuda){
if(kuda)this.kuda=kuda;else return false;

      if(document.getElementById("endroit"))this.formcity=document.getElementById("endroit");
      else {alert("error : no ID endroit");return false; }
      this.countrycode=220;
      this.reg =null;
      this.dep =null;
      this.city=null;
      this.goReg=goRegByCountry;
      this.goDep=goDepByReg;
      this.goCity=goCityByDep;
      this.setEndroit=setEndroitInForm;
      this.Ajax=new z_ajax(); 

   //  
     
       function goRegByCountry(){
       this.reg =null;
       this.dep =null;
       this.city=null;
       if(document.getElementById("help_reg"))document.getElementById("help_reg").innerHTML=''; 
       if(document.getElementById("help_dep"))document.getElementById("help_dep").innerHTML=''; 
       if(document.getElementById("help_city"))document.getElementById("help_city").innerHTML='';  
       if(document.forms["search"].country) this.countrycode=document.forms["search"].country.options[document.forms["search"].country.selectedIndex].value;
       this.Ajax.ajax(this.kuda,"&do=sydzk&t_country="+this.countrycode,"help_reg"); 
       }
       
       function goDepByReg(datin){
      if(datin){
            tai=datin.selectedIndex;
            if(tai==-1)tai=0;
            this.reg=datin.options[tai].value;
        } 
      if(document.getElementById("help_dep"))document.getElementById("help_dep").innerHTML=''; 
      if(document.getElementById("help_city"))document.getElementById("help_city").innerHTML='';
         if(datin.options[tai].value!='')
         this.Ajax.ajax(this.kuda,"&do=zycbs&t_country="+this.countrycode+"&reg="+this.reg,"help_dep"); 
       }
       
       function goCityByDep(datin){
        if(datin){
            tai=datin.selectedIndex;
            if(tai==-1)tai=0;
            this.dep=datin.options[tai].value;
        } 
      if(document.getElementById("help_city"))document.getElementById("help_city").innerHTML='';
        if(datin.options[tai].value!='')
        this.Ajax.ajax(this.kuda,"&do=ojszb&dep="+this.dep,"help_city");  
       }
    
       function setEndroitInForm(datin){
        if(datin){
            tai=datin.selectedIndex;
            if(tai==-1)tai=0;
       if(datin.options[tai].value!=''){     
       this.city=datin.options[tai].text;     
       this.formcity.value=this.city;
       setCookies('endroit',this.city,180);
       document.getElementById('divHelpEndroit').style.display='none';
       }
        }}
       }
