   function login() {
    w=window.open('login.php','','status=0,location=0,width=180,height=150,toolbar=0,location=0,directories=0,menubar=0,scrollbars=0,resizable=0,scrolling=auto');
    w.moveTo(300,300);
    //window.location.reload();
   }
   
   function feedback(codprest, nrcrt){
    document.forma13.codprest.value   = codprest;
    document.forma13.ecran.value      = 12;
    document.forma13.nrcrt.value      = nrcrt;
//    document.forma1.dspnbl.value     = dspnbl;
//    document.forma13.judet.value      = judet
//    document.forma1.localitate.value = localitate
//    document.forma13.oldecran.value   = oldecran;
    document.forma13.submit()
   }
   
   function loggin(limba, codprest, aff_id){
    document.forma6.lingua.value   = limba
    document.forma6.codprest.value = codprest
    document.forma6.ecran.value    = 8
    document.forma6.aff_id.value   = aff_id
    document.forma6.submit()
   }
   
   function viewTarife(codprest, deladata, nrzile, dspnbl, ms){
//    alert(ms); 
    document.forma12.codprest.value  = codprest
    document.forma12.deladata.value  = deladata;
    document.forma12.nrzile.value    = 31;
    document.forma12.dspnbl.value    = dspnbl;
    document.forma12.ecran.value     = 4;
    document.forma12.submit()
   }
   
   function rezervare(codprest, dspnbl, ms){
//    if(login == 0)alert('Login');
//    alert(ms); 
    document.forma3.codprest.value  = codprest;
    document.forma3.dspnbl.value    = dspnbl;
    document.forma3.ecran.value     = 5;
    document.forma3.submit()
   }
     
   function pachete(codprest){
    document.forma15.codprest.value  = codprest;
    document.forma15.ecran.value     = 5;
    document.forma15.submit()
   }
   
   function changeJudet(){
    document.forma1.judet.value = document.forma0.judet.value;
    if(document.forma1.judet.value == '')
     document.forma1.localitate.value='Bucuresti';
    else{
     document.forma1.localitate.value='';
    }
    document.forma1.ecran.value = 1;
    document.forma1.submit();
   }
   
   function changeLocalitate(){
    document.forma1.localitate.value = document.forma0.localitate.value;
    if(document.forma1.localitate.value == '')
     document.forma1.judet.value='bucurešti' 
    else
     document.forma1.judet.value='';
    document.forma1.ecran.value = 1;
    document.forma1.submit();
   }    
   
   function descriereHotel(codprest){
//    alert(codprest)
    document.forma1.judet.value      = ''
    document.forma1.localitate.value = ''
    document.forma1.ecran.value      = 2
    document.forma1.codprest.value   = codprest
    document.forma1.submit()
   }
   
   
   function preViewImage(imgUrl, imgLatime, codprestHotel, nrpoza){
    document.forma2.imageUrl.value      = imgUrl;
    document.forma2.imageLatime.value   = imgLatime;
    document.forma2.codprest.value      = codprestHotel;
    document.forma2.nrpoza.value        = nrpoza;
    document.forma2.ecran.value         = 3;
    document.forma2.submit()
   }

   function selectPlata(platitor, plata){
    document.forma11.platitor.value = platitor
    document.forma11.plata.value    = plata
//    document.forma11.submit()
   }

//   dt = "33.01.2006";
   function str2Date(dt){
//	  alert('al doilea = ' + dt)
//		alert('al treilea = ' + dt.substr(0, 2))
//		resetTime(dtSos)
    var DT = new Date();

    DT.setFullYear(dt.substr(6, 4));
    DT.setMonth(dt.substr(3, 2)-1, dt.substr(0, 2));
    DT.rostr = dt
//    alert('al patrulea = ' + DT)
    return DT;
   }
   
   function resetTime(dt){
    dt.setHours(0);
    dt.setMinutes(0);
    dt.setSeconds(0);
   }
   
   function isDate(dt){
//    alert('dt = '+dt)
    strZiua = String(dt.getDate()   );/*alert('strZiua = '+strZiua); */if(strZiua.length == 1)strZiua = "0" + strZiua;
    strLuna = String(dt.getMonth()+1); if(strLuna.length == 1)strLuna = "0" + strLuna;
    strAnul = String(dt.getFullYear()   );
//    alert(dt.getFullYear());
    sd      = strZiua + '.' + strLuna + '.' + strAnul
//    alert(dt.rostr + ' - ' + sd + ' = ' + strZiua + "." + strLuna)
    if (dt.rostr == sd)return true;
    else               return false;
   }
   
   function continuaRezerv1(codprest, ms1, ms2, ms3, ms4){
    if(document.formaSelectie.tara.value == ''){alert (ms4);return false;}
//    alert('primul = '+document.formaSelectie.data1.value)
    dtSos         = str2Date(document.formaSelectie.data1.value); resetTime(dtSos); 
    dtPlc         = str2Date(document.formaSelectie.data2.value);
//    alert(dtSos + ' - ' + dtPlc)
    dtCur         = new Date();
//alert (dtCur)
    dtCurMinusUnu = new Date(); dtCurMinusUnu.setDate(dtCur.getDate() - 1)
    d1 = dtCurMinusUnu.getTime()
    d2 = dtCur.getTime()
// * Gabi 30/31.10 *    if(!isDate(dtSos) || !isDate(dtPlc)){                       alert (ms3+' - 1 -'+dtSos + ' - ' + dtPlc); return false;}
    if(dtSos.getTime() >= dtPlc.getTime()){                     alert (ms3+' - 2'); return false;}
    if((dtSos.getTime()+6*3600*1000) < dtCurMinusUnu.getTime()){alert (ms3+' - 3'); return false;}
    document.forma5.datasosire.value  = document.formaSelectie.data1.value
    document.forma5.dataplecare.value = document.formaSelectie.data2.value
    document.forma5.tara.value        = document.formaSelectie.tara.value
    document.forma5.codprest.value    = codprest
    document.forma5.ecran.value       = 7
    document.forma5.submit()
   }
   
/*
   function continuaRezerv1(codprest, ms1, ms2, ms3, ms4){
   }
*/

   function continuaRezerv2(ms){
//    document.forma11.datasosire.value  = data1.value
//    document.forma11.dataplecare.value = data2.value
//    document.forma11.tara.value        = tara.value
//    document.forma11.codprest.value    = codprest
    if(document.forma11.plata.value < 0){
     alert(ms);
     return false;
    }
    document.forma11.submit()
   }

   
   function exec(ms1, ms2, ms3, ms4){
    d1 = document.forma22.deladata.value
    d2 = document.forma22.pinladata.value
    
    if (d1 == ""){document.forma22.deladata.focus(); return false}
    if (d2 == ""){document.forma22.pinladata.focus();return false}
    
    dat1 = fnctDataYMDPlusZile(d2, 0)
    if (dat1 > '2020-12-31'){
     alert(ms1)
     return false;
    }

    dat1 = fnctDataYMDPlusZile(d2, 0)
    dat2 = fnctDataYMDPlusZile(d1, 360)
    if (dat1 > dat2){
     alert(ms2)
     return false;
    }
    
    dat1 = fnctDataYMDPlusZile(d2, 0)
    dat2 = fnctDataYMDPlusZile(d1, 60)
    if (dat1 > dat2)
     if(!confirm(ms3))
      return false;

    dat1 = fnctDataYMDPlusZile(d2, 0)
    dat2 = fnctDataYMDPlusZile(d1, 0)
    if (dat1 <= dat2){
     alert(ms4) 
     return false;
    }
    document.forma22.submit()
   }

   
   
   
   
   function checkPerioada(datasosire, dataplecare, ms1, ms2, ms3){
    dat1 = fnctDataYMDPlusZile(datasosire, 0)
    dat2 = fnctDataYMDPlusZile(dataplecare, 0)
    dat3 = dataCurenta()
    if (dat2 > '2020-12-31'){
     alert(ms1)
     return false;
    }
    
    dattmp = fnctDataYMDPlusZile(dat3, 365)
    if (dat2 > dattmp){
     alert(ms2)
     return false;
    }

    if((dat1 >= dat2) || (dat3 > dat1)){
     alert(ms3)
     return false
    }

/*
*/
    return true
   }
   
   
   
   
   
   function fnctDataYMDPlusZile(dataZzLlAaaa, nrzile){
    var data = dataZzLlAaaa
  
    if (data.substr(2,1) == ".")
     var dt   = new Date(Number(data.substr(6,4)), 
                     (Number(data.substr(3,2))-1), 
                     (Number(data.substr(0,2))+Number(nrzile)), 3, 0, 0)
    if (data.substr(4,1) == "-")
     var dt   = new Date(Number(data.substr(0,4)), 
                     (Number(data.substr(5,2))-1), 
                     (Number(data.substr(7,2))+Number(nrzile)), 3, 0, 0)
    dtY = dt.getYear();
    if(dtY < 1000)dtY = dtY + 1900;
    var strAnul = String(dtY)
    var strLuna = String(Number(dt.getMonth())+1)
    var strZiua = String(dt.getDate())
    if (strZiua.length == 1) strZiua  = '0'     + strZiua
    if (strLuna.length == 1) strLuna  = '0'     + strLuna
    return strAnul+'-'+strLuna+'-'+strZiua
   }

   function dataCurenta(){
    var data = new Date();

    dtY = data.getYear();
    if(dtY < 1000)dtY = dtY + 1900;
    strAnul = String(dtY)
    strLuna = String(data.getMonth()+1)
    strZiua = String(data.getDate())
    if(strLuna.length < 2) strLuna = "0" + strLuna 
    if(strZiua.length < 2) strZiua = "0" + strZiua 
    return strAnul + "-"+ strLuna + "-" + strZiua
   }
   
   
   function verifData(field){
    var data;
    var strZiua;
    var strLuna;
    var strAnul;
    var intZiua;
    var intLua;
    var intAnul;
    var len;
    var booFound;
    var strTabDate  = new Array(3);
    var strTabSepar = new Array("-"," ","/",".");
    strDate = field.value;
    len     = strTabSepar.length;
    if (strDate == "") return true;
     for (i = 0; i < len; i++) {
      if (strDate.indexOf(strTabSepar[i]) != -1){
       strTabDate = strDate.split(strTabSepar[i]);    
      if (strTabDate.length != 3){
//alert(strTabDate.length);
       field.value = "";
       field.focus();
       return false;
      }
      else{
       strZiua = strTabDate[0]; 
       strLuna = strTabDate[1];     
       strAnul = strTabDate[2];
       if((strZiua == '')||(strLuna == '')||(strAnul == '')){
        field.value = "";
        field.focus();
        return false;
       }
       if(isNaN(Number(strZiua))||isNaN(Number(strLuna))||isNaN(Number(strAnul))){
        field.value = "";
        field.focus();
        return false;
       }
      }
      booFound  = true;
     }
    }


    if (booFound == false){
     if (strDate.length > 5){
      strZiua = strDate.substr(0, 2);
      strLuna = strDate.substr(2, 2);    
      strAnul = strDate.substr(4);   }
     else{
      field.value = "";    
      field.focus();
      return false;
     }
    }
    intZiua  = Number(strZiua);
    intLuna  = Number(strLuna);
    intAnul  = Number(strAnul);
    data     = new Date(intAnul, (intLuna - 1), intZiua, 3, 0, 0);  

    dtY = data.getYear();
    if(dtY < 1000)dtY = dtY + 1900;
    
//    if ((data.getYear()  != intAnul)||(data.getMonth() != (intLuna - 1)) || (data.getDate()  != intZiua)){
    if ((dtY  != intAnul)||(data.getMonth() != (intLuna - 1)) || (data.getDate()  != intZiua)){
     field.focus();
     field.value = "";
     return false
    }
    else {
     if (strZiua.length == 1) strZiua = "0" + strZiua;
     if (strLuna.length == 1) strLuna = "0" + strLuna;
     if (strAnul.length == 1) strAnul = "200" + strAnul; 
     if (strAnul.length == 2) strAnul = "20"  + strAnul;
     field.value = strZiua + "." + strLuna + "." + strAnul;
     return true
    }
   }
//  , 
   function reztel(){
    q = open("http://www.tourneo.ro/F_New/",             "prima", 'width=666, height=665,toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,scrolling=auto')
    p = open("http://www.tourneo.ro/F_New/0/dialog.php", "dialog", 'width=470, height=710,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,scrolling=auto')
//    p.moveTo(520, 0)
   }
