// source --> https://universum.hu/wp-includes/js/zxcvbn-async.min.js?ver=1.0 
/*! This file is auto-generated */
!function(){function t(){var t,e=document.createElement("script");return e.src=_zxcvbnSettings.src,e.type="text/javascript",e.async=!0,(t=document.getElementsByTagName("script")[0]).parentNode.insertBefore(e,t)}null!=window.attachEvent?window.attachEvent("onload",t):window.addEventListener("load",t,!1)}.call(this);
// source --> https://universum.hu/etestcontenta/themes/hello_w/wsz-shop.js?iuystr=24csdd4dsssds34sad5&#038;ver=6.2.2 
function loopqInit(testopt){
  let testval = parseInt(jQuery(testopt).val());
  let maxerId = parseInt(jQuery(testopt).attr('data-attr-id'));
  let maxer = jQuery('#mday'+jQuery('input[name="date1"]').val().replace("-", "").replace("-", "")).children('.availableTipph').find('.prodcalname[data-attr-id="'+parseInt(maxerId)+'"]').attr('data-attr-max');
      maxer = parseInt(maxer);
      if(jQuery('input[name="date2"]').val() != ''){
        const startDateInput = jQuery('input[name="date1"]').val();
        const endDateInput = jQuery('input[name="date2"]').val();

        const startDate = new Date(startDateInput);
        const endDate = new Date(endDateInput);

        if (isNaN(startDate) || isNaN(endDate)) {
            //alert('KĂŠrlek, megfelelĹ formĂĄtumĂş dĂĄtumokat adj meg (YYYY-MM-DD)!');
            //return;
        }else{
          const dateArray = [];
          let currentDate = startDate;

          while (currentDate <= endDate) {
              dateArray.push(currentDate.toISOString().split('T')[0]);
              currentDate.setDate(currentDate.getDate() + 1);

              let id = '#mday'+(currentDate.toISOString().split('T')[0]).replace("-", "").replace("-", "");
              let actmaxer = jQuery(id).children('.availableTipph').find('.prodcalname[data-attr-id="'+parseInt(maxerId)+'"]').attr('data-attr-max');
              if(maxer > actmaxer){
                maxer = actmaxer;
              }
          }

        }
      }

  jQuery(testopt).find('option').remove();
	
    jQuery(testopt).append(jQuery('<option value="0">szobák</option>'));
	
  for (var i = 1; i <= maxer; i++) {
    jQuery(testopt).append(jQuery('<option value="'+i+'" '+(testval == i ? 'selected=selected ' : '')+'>'+i+'</option>'));
  }
}


function cleanerser(a){
//  var s = "-12345.50 âŹ".replace(/[^\d.-]/g, ''); // gives "-12345.50"
  a = a.replace(/[^\d,#-]/g, '');
  return a;
}
function naptars(a){
    jQuery('.endplaceposter').html('');
    
    var numek = jQuery(a).hasClass('hoprev') ? '2' : '4';
    var exparent = jQuery(a).parent().parent().parent().parent();
    var page = 0;
    if(jQuery(exparent).attr('data-attr-rela5') == '12' && numek == '4'){
      page = parseInt(jQuery(exparent).attr('data-attr-rela3'));
    }else if(jQuery(exparent).attr('data-attr-rela5') == '1' && numek == '2'){
      page = parseInt(jQuery(exparent).attr('data-attr-rela'));
    }
    if(page != 0){
      var ajaxurl = 'https://universum.hu/wp-admin/admin-ajax.php';
      var data = {
         'action': 'calendars',
         'dates': page,
      };
      jQuery.post(ajaxurl, data, function(response) {
         if(response.length > 14) {
            jQuery('table.naptar').remove();
            if(response.slice(-1) == '0'){
                response = response.slice(0, -1) 
            }else if(response.charAt(0) == '0'){
                response = response.substring(1);
            }
            jQuery('.naptcont').html(response);
            if(numek == '2'){
              jQuery('.naptar').removeClass('activeho');
              jQuery('.naptar[data-attr-rela5="12"').addClass('activeho');
            }
            /*
            jQuery('.hoarrow').on("click", function( event ) {
              var a = jQuery(this);
              naptars(a);
            });
            jQuery('.cdts').on("click", function( event ) {
              naptardayz(jQuery(this).attr('id'));
              jQuery('.cdts').removeClass('aktnap');
              jQuery(this).addClass('aktnap');
            });
            jQuery('.postarrow').on("click", function( event ) {
              var a = jQuery(this).attr('data-attr-date');
              naptardayz(a);
            });
            jQuery('.naptcont').on("click", function( event ) {
              jQuery('.naptcont').removeClass('activers');
            });
            jQuery('.naptarend').on("click", function( event ) {
              jQuery('.naptcont').addClass('activers');
            });
            */

            jQuery('.cdts').on("click", function( event ) {
                if(clicker != 1){
                  jQuery('.cdts').removeClass('aktnap');
                  clicker = 1;
                  jQuery('.naptcont').attr('data-attr-relday',jQuery(this).attr('data-attr-relmi'));
                  naptardayz(jQuery(this).attr('id').replace("-", "").replace("-", ""));
                  jQuery(this).addClass('aktnap');
                  jQuery('.dayz'+jQuery('.naptcont').attr('data-attr-relday')).addClass('aktnap');
                  let allTestc = document.getElementsByClassName('naptar');
                  let testCount = allTestc.length;
                  setTimeout(function() {
                    //jQuery(actdiv).addClass('aktnap');
                    jQuery('.dayz'+jQuery('.naptcont').attr('data-attr-relday')).addClass('aktnap');
                    for (var i2 = 0; i2 < testCount; i2++) {
                      let allTestcCont = jQuery(allTestc[i2]).find('.aktnap');
                      if(allTestcCont.length){
                      }else{
                        jQuery(allTestc[i2]).find('.dayz1').addClass('aktnap');
                      }
                    }
                  }, 400);
                }
              });
             /*jQuery('.naptcont').on("click", function( event ) {
                if(clicker != 1){
                  clicker = 1;
                  jQuery('.naptcont').removeClass('activers');
                }
              });
              jQuery('.naptarend').on("click", function( event ) {
                if(clicker != 1){
                  clicker = 1;
                  jQuery('.naptcont').addClass('activers');
                }
              });*/
              jQuery('.hoarrow').on("click", function( event ) {
                if(clicker != 1){
                  clicker = 1;
                  var a = jQuery(this);
                  naptars(a);
                }
              });
              jQuery('.postarrow').on("click", function( event ) {
                if(clicker != 1){
                  clicker = 1;
                  var a = jQuery(this).attr('data-attr-date');
      
                  jQuery('.naptcont').attr('data-attr-relday',parseInt(jQuery(this).attr('data-attr-edated')));
      
                  if(jQuery(this).hasClass('arrnext')){
                    if(parseInt(jQuery(this).attr('data-attr-datem')) == 12 && parseInt(jQuery(this).attr('data-attr-edatem')) < parseInt(jQuery(this).attr('data-attr-datem'))){
                      clicker = 0;
                      jQuery('.activeho').find('.honext').click();
                    }else{
                      if(parseInt(jQuery(this).attr('data-attr-edatem')) > parseInt(jQuery(this).attr('data-attr-datem'))){
                        clicker = 0;
                        jQuery('.activeho').find('.honext').click();
                      }else{
                        clicker = 0;
                        jQuery('#mday'+jQuery(this).attr('data-attr-datey')+'-'+jQuery(this).attr('data-attr-datem')+'-'+jQuery(this).attr('data-attr-edated')).click();
                        //naptardayz(a);
                      }
                    }
                  }else if(jQuery(this).hasClass('arrprev')){
                    if(parseInt(jQuery(this).attr('data-attr-datem')) == 1 && parseInt(jQuery(this).attr('data-attr-edatem')) > parseInt(jQuery(this).attr('data-attr-datem'))){
                      clicker = 0;
                      jQuery('.activeho').find('.hoprev').click();
                    }else{
                      if(parseInt(jQuery(this).attr('data-attr-edatem')) < parseInt(jQuery(this).attr('data-attr-datem'))){
                        clicker = 0;
                        jQuery('.activeho').find('.hoprev').click();
                      }else{
                        clicker = 0;
                        jQuery('#mday'+jQuery(this).attr('data-attr-datey')+'-'+jQuery(this).attr('data-attr-datem')+'-'+jQuery(this).attr('data-attr-edated')).click();
                        //naptardayz(a);
                      }
                    }
                  }else{
                    clicker = 0;
                    jQuery('#mday'+jQuery(this).attr('data-attr-datey')+'-'+jQuery(this).attr('data-attr-datem')+'-'+jQuery(this).attr('data-attr-edated')).click();
                    //naptardayz(a);
                  }
                }
              });

              setTimeout(function() {
                clicker = 0;
                var owl = jQuery('.idemegy');
                startcarouselem(owl);
                //var actdiv = jQuery('.activeho').find(jQuery('td.cdts.aktnap'));
                var actdiv = jQuery('.activeho').find(jQuery('td.cdts.dayz'+jQuery('#naptcont').attr('data-attr-relday')));
                var reld = '';  
                if(actdiv === null){
                  var actdiv = jQuery('.activeho').find(jQuery('td.cdts.dayz1'));
                  reld = '1';
                }else{
                  reld = jQuery('.naptcont').attr('data-attr-relday');
                }
                if(actdiv != null){
                  //clicker = 1;
                  jQuery(actdiv).click();
                  setTimeout(function() {
                    jQuery(actdiv).addClass('aktnap');
                    jQuery('.dayz'+reld).addClass('aktnap');
                  }, 400);
                }else{
                  clicker = 0;
                }
              }, 200);

         }else{
          clicker = 0;
         }
      });
    }else{
      jQuery(a).parent().parent().parent().parent().removeClass('activeho');
      jQuery('.naptar[data-attr-rela5="'+jQuery(a).parent().parent().parent().parent().attr('data-attr-rela'+numek)+'"]').addClass('activeho');
        clicker = 0;
      //var actdiv = jQuery('.activeho').find(jQuery('td.cdts.aktnap'));
      var actdiv = jQuery('.activeho').find(jQuery('td.cdts.dayz'+jQuery('#naptcont').attr('data-attr-relday')));
     //alert(actdiv);
                
      if(actdiv.attr('class') == undefined){
        actdiv = jQuery('.activeho').find(jQuery('.dayz'+jQuery('.naptcont').attr('data-attr-relday')));
        if(actdiv.attr('class') == undefined){
          actdiv = jQuery('.activeho').find(jQuery('.dayz1'));
        //alert(actdiv);
                
          jQuery('#naptcont').attr('data-attr-relday','1');
        }
        if(actdiv.attr('class') != undefined){
          //clicker = 1;
          jQuery(actdiv).click();
         // setTimeout(function() {
           // jQuery(actdiv).addClass('aktnap');
            //jQuery('.dayz'+jQuery('.naptcont').attr('data-attr-relday')).addClass('aktnap');
          //}, 400);
        }else{
          clicker = 0;
        }
      }else{
        if(actdiv.attr('class') != undefined){
          //clicker = 1;
          jQuery(actdiv).click();
         // setTimeout(function() {
           // jQuery(actdiv).addClass('aktnap');
            //jQuery('.dayz'+jQuery('.naptcont').attr('data-attr-relday')).addClass('aktnap');
          //}, 400);
        }else{
          clicker = 0;
        }
      }

      jQuery('.postarrow').on("click", function( event ) {
              if(clicker != 1){
                clicker = 1;
                var a = jQuery(this).attr('data-attr-date');
      
                jQuery('.naptcont').attr('data-attr-relday',parseInt(jQuery(this).attr('data-attr-edated')));
      
                if(jQuery(this).hasClass('arrnext')){
                  if(parseInt(jQuery(this).attr('data-attr-datem')) == 12 && parseInt(jQuery(this).attr('data-attr-edatem')) < parseInt(jQuery(this).attr('data-attr-datem'))){
                    clicker = 0;
                    jQuery('.activeho').find('.honext').click();
                  }else{
                    if(parseInt(jQuery(this).attr('data-attr-edatem')) > parseInt(jQuery(this).attr('data-attr-datem'))){
                      clicker = 0;
                      jQuery('.activeho').find('.honext').click();
                    }else{
                      clicker = 0;
                      jQuery('#mday'+jQuery(this).attr('data-attr-datey')+'-'+jQuery(this).attr('data-attr-datem')+'-'+jQuery(this).attr('data-attr-edated')).click();
                      //naptardayz(a);
                    }
                  }
                }else if(jQuery(this).hasClass('arrprev')){
                  if(parseInt(jQuery(this).attr('data-attr-datem')) == 1 && parseInt(jQuery(this).attr('data-attr-edatem')) > parseInt(jQuery(this).attr('data-attr-datem'))){
                    clicker = 0;
                    jQuery('.activeho').find('.hoprev').click();
                  }else{
                    if(parseInt(jQuery(this).attr('data-attr-edatem')) < parseInt(jQuery(this).attr('data-attr-datem'))){
                      clicker = 0;
                      jQuery('.activeho').find('.hoprev').click();
                    }else{
                      clicker = 0;
                      jQuery('#mday'+jQuery(this).attr('data-attr-datey')+'-'+jQuery(this).attr('data-attr-datem')+'-'+jQuery(this).attr('data-attr-edated')).click();
                      //naptardayz(a);
                    }
                  }
                }else{
                  clicker = 0;
                  jQuery('#mday'+jQuery(this).attr('data-attr-datey')+'-'+jQuery(this).attr('data-attr-datem')+'-'+jQuery(this).attr('data-attr-edated')).click();
                  //naptardayz(a);
                }
              }
            });
    }
}
function naptardayz(a){

    if(a != 0){
      var ajaxurl = 'https://universum.hu/wp-admin/admin-ajax.php';
      var data = {
         'action': 'calendars2',
         'dates': a,
      };
      jQuery.post(ajaxurl, data, function(response) {
         if(response.length > 9) {
          //if (this.readyState == 4) {
            if(response.slice(-1) == '0'){
                response = response.slice(0, -1) 
            }else if(response.charAt(0) == '0'){
                response = response.substring(1);
            }
            jQuery('.endplaceposter').html(response);
            
            jQuery('.postarrow').on("click", function( event ) {
              if(clicker != 1){
                clicker = 1;
                var a = jQuery(this).attr('data-attr-date');
      
                jQuery('.naptcont').attr('data-attr-relday',parseInt(jQuery(this).attr('data-attr-edated')));
      
                if(jQuery(this).hasClass('arrnext')){
                  if(parseInt(jQuery(this).attr('data-attr-datem')) == 12 && parseInt(jQuery(this).attr('data-attr-edatem')) < parseInt(jQuery(this).attr('data-attr-datem'))){
                    clicker = 0;
                    jQuery('.activeho').find('.honext').click();
                  }else{
                    if(parseInt(jQuery(this).attr('data-attr-edatem')) > parseInt(jQuery(this).attr('data-attr-datem'))){
                      clicker = 0;
                      jQuery('.activeho').find('.honext').click();
                    }else{
                      clicker = 0;
                      jQuery('#mday'+jQuery(this).attr('data-attr-datey')+'-'+jQuery(this).attr('data-attr-datem')+'-'+jQuery(this).attr('data-attr-edated')).click();
                      //naptardayz(a);
                    }
                  }
                }else if(jQuery(this).hasClass('arrprev')){
                  if(parseInt(jQuery(this).attr('data-attr-datem')) == 1 && parseInt(jQuery(this).attr('data-attr-edatem')) > parseInt(jQuery(this).attr('data-attr-datem'))){
                    clicker = 0;
                    jQuery('.activeho').find('.hoprev').click();
                  }else{
                    if(parseInt(jQuery(this).attr('data-attr-edatem')) < parseInt(jQuery(this).attr('data-attr-datem'))){
                      clicker = 0;
                      jQuery('.activeho').find('.hoprev').click();
                    }else{
                      clicker = 0;
                      jQuery('#mday'+jQuery(this).attr('data-attr-datey')+'-'+jQuery(this).attr('data-attr-datem')+'-'+jQuery(this).attr('data-attr-edated')).click();
                      //naptardayz(a);
                    }
                  }
                }else{
                  clicker = 0;
                  jQuery('#mday'+jQuery(this).attr('data-attr-datey')+'-'+jQuery(this).attr('data-attr-datem')+'-'+jQuery(this).attr('data-attr-edated')).click();
                  //naptardayz(a);
                }
              }
            });
            /*
            jQuery('.hoarrow').on("click", function( event ) {
              var a = jQuery(this);
              naptars(a);
            });
            jQuery('.cdts').on("click", function( event ) {
              naptardayz(jQuery(this).attr('id'));
              jQuery('.cdts').removeClass('aktnap');
              jQuery(this).addClass('aktnap');
            });
           
            jQuery('.naptcont').on("click", function( event ) {
              jQuery('.naptcont').removeClass('activers');
            });
            jQuery('.naptarend').on("click", function( event ) {
              jQuery('.naptcont').addClass('activers');
            });*/
            setTimeout(function() {
              var owl = jQuery('.idemegy');
              startcarouselem(owl);
            clicker = 0;
            }, 200);
         }else{
          clicker = 0;
         }
      });
    }else{
      clicker = 0;
    }
}
function emailValer(ab){
  var format = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,3})$/;
  if(ab.match(format)){
    return 1;
  }else{return 2;}
}
function numVali(wrapper){
  if(! jQuery(wrapper).attr('id')){
    jQuery(wrapper).attr('id',('ids'+Math.floor(Math.random() * 22) + 1)+'riiid'+(Math.floor(Math.random() * 120) + 1)+'ds');
  }
  var rel2 = jQuery(wrapper).val();
  rel2 = rel2.replace(/ /g, "");
  rel2 = rel2.replaceAll('-', '');
  rel2 = rel2.replaceAll('+', '');
  rel2 = rel2.replace(/[^0-9]/g, '');
  rel2 = rel2.replace(/[^\d.-]/g, '');
  var mi = document.getElementById(jQuery(wrapper).attr('id'));
  mi.value = rel2;
  if(rel2.length > 3) {
      wrapper.addClass( 'wsz-invalid' );
  }else{
      if(jQuery(wrapper).attr('max')){
        if(rel2 > parseInt(jQuery(wrapper).attr('max'))){
          wrapper.addClass( 'wsz-invalid' );
        }else{
          wrapper.removeClass( 'wsz-invalid' );
        }
      }else{
        wrapper.removeClass( 'wsz-invalid' );
      }
  }
}
function mailVali(wrapper){
  if(! jQuery(wrapper).attr('id')){
    jQuery(wrapper).attr('id',('ids'+Math.floor(Math.random() * 22) + 1)+'roood'+(Math.floor(Math.random() * 120) + 1)+'ds');
  }
  var mi = document.getElementById(jQuery(wrapper).attr('id'));
  var rel2 = mi.value;
  if(rel2.length > 0) {
      if(emailValer(rel2) === 1){
        wrapper.removeClass( 'wsz-invalid-format' );
        wrapper.removeClass( 'wsz-invalid-req' );
        wrapper.removeClass( 'wsz-invalid' );
        wrapper.parent().removeClass( 'wsz-invalid-format' );
        wrapper.parent().removeClass( 'wsz-invalid-req' );
        wrapper.parent().removeClass( 'wsz-invalid' );
      }else{
        wrapper.removeClass( 'wsz-invalid-req' );
        wrapper.addClass( 'wsz-invalid' );
        wrapper.addClass( 'wsz-invalid-format' );
        wrapper.parent().removeClass( 'wsz-invalid-req' );
        wrapper.parent().addClass( 'wsz-invalid' );
        wrapper.parent().addClass( 'wsz-invalid-format' );
    }
  }else{
      wrapper.removeClass( 'wsz-invalid-format' );
      wrapper.parent().removeClass( 'wsz-invalid-format' );
      wrapper.addClass( 'wsz-invalid-req' );
      wrapper.addClass( 'wsz-invalid' );
      wrapper.parent().addClass( 'wsz-invalid-req' );
      wrapper.parent().addClass( 'wsz-invalid' );
  }
}
function logVali(wrapper){
  if(! jQuery(wrapper).attr('id')){
    jQuery(wrapper).attr('id',('ids'+Math.floor(Math.random() * 22) + 1)+'raaad'+(Math.floor(Math.random() * 120) + 1)+'ds');
  }
  var mi = document.getElementById(jQuery(wrapper).attr('id'));
  var rel2 = mi.value;
  if(rel2.length > 0) {
     wrapper.removeClass( 'wsz-invalid-req' );
      wrapper.removeClass( 'wsz-invalid' );
      wrapper.parent().removeClass( 'wsz-invalid-req' );
      wrapper.parent().removeClass( 'wsz-invalid' );
  }else{
      wrapper.addClass( 'wsz-invalid-req' );
      wrapper.addClass( 'wsz-invalid' );
      wrapper.parent().addClass( 'wsz-invalid-req' );
      wrapper.parent().addClass( 'wsz-invalid' );
  }
}
function passVali(wrapper) {
  if(! jQuery(wrapper).attr('id')){
    jQuery(wrapper).attr('id',('ids'+Math.floor(Math.random() * 22) + 1)+'reeed'+(Math.floor(Math.random() * 120) + 1)+'ds');
  }
  var mi = document.getElementById(jQuery(wrapper).attr('id'));
  var rel2 = mi.value;
  if(rel2.length > 0) {
     wrapper.removeClass( 'wsz-invalid-req' );
      wrapper.removeClass( 'wsz-invalid' );
      wrapper.parent().removeClass( 'wsz-invalid-req' );
      wrapper.parent().removeClass( 'wsz-invalid' );
  }else{
      wrapper.addClass( 'wsz-invalid-req' );
      wrapper.addClass( 'wsz-invalid' );
      wrapper.parent().addClass( 'wsz-invalid-req' );
      wrapper.parent().addClass( 'wsz-invalid' );
  }
}
function reqVali(wrapper) {
  if(! jQuery(wrapper).attr('id')){
    jQuery(wrapper).attr('id',('ids'+Math.floor(Math.random() * 22) + 1)+'ruuud'+(Math.floor(Math.random() * 120) + 1)+'ds');
  }
  var mi = document.getElementById(jQuery(wrapper).attr('id'));
  var rel2 = mi.value;
  if(jQuery(wrapper).attr('type') === 'checkbox'){
    if (mi.checked == true){
      rel2 = '1';
    }else{
      rel2 = '';
    }
  }
  if(rel2.length > 0) {
      wrapper.removeClass( 'wsz-invalid-req' );
      wrapper.removeClass( 'wsz-invalid' );
  }else{
      wrapper.addClass( 'wsz-invalid-req' );
      wrapper.addClass( 'wsz-invalid' );
  }
}
function schooler(){
    var aktsc = document.getElementById('getscholler');
    var aktval = aktsc.options[aktsc.selectedIndex].value;
    var akttext = aktsc.options[aktsc.selectedIndex].text;
    if(aktval == '3'){
      jQuery('.tml-uni_intezmeny_sel-wrap').css('display','block');
      jQuery('.tml-uni_intezmeny_text-wrap').css('display','none');
    }else{
      jQuery('.tml-uni_intezmeny_sel-wrap').css('display','none');
      jQuery('.tml-uni_intezmeny_text-wrap').css('display','block');
    }
}
function ferohelytest(){
  let e = document.getElementById("pa_ferohelyek");
  let de = document.getElementById("start_date");
  if(e != null && de != null){
    
    let value = parseInt(e.value);
    jQuery('.thwepo-extra-options').find('tr').css('display','none');
    let allok = 0;
    let fullok = 0;
    if(jQuery('#start_date').val().length > 0 && jQuery('#end_date').val().length > 0){
      jQuery('.booking_price').addClass('okke');
      for (var i = 1; i <= value; i++) {
          jQuery('.alldat'+i).css('display','table-row');
          let allTestp = document.getElementsByClassName('alldat'+i);
          let testCount = allTestp.length;
          let testok = 0;
          for (var i2 = 0; i2 < testCount; i2++) {
            let testTextArea = jQuery(allTestp[i2]).find('textarea');
            if(testTextArea.length){
              if(testTextArea.val().length > 3){
                testok = testok + 1;
              }
            }
            testTextArea = jQuery(allTestp[i2]).find('input');
            if(testTextArea.length){
              if(testTextArea.val().length > 3){
                testok = testok + 1;
              }
            }  
          }
          if(testok === testCount){
            allok += 1;
          }
          fullok += 1;
      }
      jQuery('.ifatags').css('display','table-row');
      if(value > 0){
        jQuery('.wc-dnd-file-upload').addClass('disapp');
      }else{
        jQuery('.wc-dnd-file-upload').removeClass('disapp');
      }
      if(allok === fullok){
        if(jQuery('#start_date').val().length > 0 && jQuery('#end_date').val().length > 0){
            jQuery('.single_add_to_cart_button.button.alt').removeClass('dispe');
        }else{
          jQuery('.single_add_to_cart_button.button.alt').addClass('dispe');
        }
      }else{
        jQuery('.single_add_to_cart_button.button.alt').addClass('dispe');
      }
    }else{
        jQuery('.booking_price').removeClass('okke');
        jQuery('.wc-dnd-file-upload').removeClass('disapp');
        jQuery('.single_add_to_cart_button.button.alt').addClass('dispe');

    }
  }
}
function startcarouselem33(owl){
  var owl2 = jQuery('.idemegy2');
	var sdai2 = 0;
	if(owl2.hasClass('sdai')){
		sdai2 = 1;	
	}
    jQuery('#idemegy2').css('opacity',1);
owl2.owlCarousel({
    items:(sdai2 === 1 ? 3 : 3),
	loop:true,
    margin: 0.01 * (window.innerWidth / 19.2 ),
  navText: ['<svg class="carousel-slider-nav-icon" viewBox="0 0 20 20"><path d="M14 5l-5 5 5 5-1 2-7-7 7-7z"></path></svg>','<svg class="carousel-slider-nav-icon" viewBox="0 0 20 20"><path d="M6 15l5-5-5-5 1-2 7 7-7 7z"></path></svg>'],
  dots: false,
	rtl:(sdai2 === 1 ? true : false),
    autoplayHoverPause:true,
  responsiveClass:true,
    responsive:{
        0:{
            items:1,
            nav:false,
        autoplay:0,
      margin: 0.01 * (window.innerWidth / 19.2 ),
      mouseDrag: (sdai2 === 1 ? true : false),
      touchDrag: (sdai2 === 1 ? true : false),
      pullDrag: (sdai2 === 1 ? true : false),
      freeDrag: (sdai2 === 1 ? true : false),
        },
        767:{
            items:(sdai2 === 1 ? 2 : 2),
            nav:true,
        autoplay:true,
      margin: 0.01 * (window.innerWidth / 19.2 ),
      mouseDrag: true,
      touchDrag: true,
      pullDrag: true,
      freeDrag: true,
      autoplayTimeout:(sdai2 === 1 ? 2500 : 25000),
      autoplaySpeed:500,
        },
        1101:{
            items:(sdai2 === 1 ? 3 : 3),
            nav:true,
        autoplay:true,
      margin: 0.01 * (window.innerWidth / 19.2 ),
      mouseDrag: true,
      touchDrag: true,
      pullDrag: true,
      freeDrag: false,
      autoplayTimeout:(sdai2 === 1 ? 2500 : 25000),
      autoplaySpeed:500,
        },
    }
});
}
function startcarouselemAller(owl){
  var owl2 = jQuery(owl);
    owl2.css('opacity',1);
owl2.owlCarousel({
    items:3,
    loop:true,
    margin: 0.01 * (window.innerWidth / 19.2 ),
  navText: ['<svg class="carousel-slider-nav-icon" viewBox="0 0 20 20"><path d="M14 5l-5 5 5 5-1 2-7-7 7-7z"></path></svg>','<svg class="carousel-slider-nav-icon" viewBox="0 0 20 20"><path d="M6 15l5-5-5-5 1-2 7 7-7 7z"></path></svg>'],
  dots: false,
    autoplayHoverPause:true,
  responsiveClass:true,
    responsive:{
        0:{
            items:1,
            nav:true,
        autoplay:false,
      margin: 0.01 * (window.innerWidth / 19.2 ),
      mouseDrag: true,
      touchDrag: true,
      pullDrag: false,
      freeDrag: false,
        },
        767:{
            items:2,
            nav:true,
        autoplay:false,
      margin: 0.01 * (window.innerWidth / 19.2 ),
      mouseDrag: true,
      touchDrag: true,
      pullDrag: false,
      freeDrag: false,
        },
        1101:{
            items:2,
            nav:true,
        autoplay:false,
      margin: 0.01 * (window.innerWidth / 19.2 ),
      mouseDrag: true,
      touchDrag: true,
      pullDrag: false,
      freeDrag: false,
        },
        1201:{
            items:3,
            nav:true,
        autoplay:false,
      margin: 0.01 * (window.innerWidth / 19.2 ),
      mouseDrag: true,
      touchDrag: true,
      pullDrag: false,
      freeDrag: false,
        },
    }
});
}
function startcarouselem(owl){
  var owl = jQuery('#idemegy');
	var sdai = 0;
	if(owl.hasClass('sdai')){
		sdai = 1;	
	}
    jQuery('#idemegy').css('opacity',1);
owl.owlCarousel({
    items:(sdai === 1 ? 3 : 3),
    loop:true,
    margin: 0.01 * (window.innerWidth / 19.2 ),
  navText: ['<svg class="carousel-slider-nav-icon" viewBox="0 0 20 20"><path d="M14 5l-5 5 5 5-1 2-7-7 7-7z"></path></svg>','<svg class="carousel-slider-nav-icon" viewBox="0 0 20 20"><path d="M6 15l5-5-5-5 1-2 7 7-7 7z"></path></svg>'],
  dots: false,
    autoplayHoverPause:true,
  responsiveClass:true,
    responsive:{
        0:{
            items:1,
            nav:false,
        autoplay:0,
      margin: 0.01 * (window.innerWidth / 19.2 ),
      mouseDrag: (sdai === 1 ? true : false),
      touchDrag: (sdai === 1 ? true : false),
      pullDrag: (sdai === 1 ? true : false),
      freeDrag: (sdai === 1 ? true : false),
        },
        767:{
            items:(sdai === 1 ? 2 : 2),
            nav:true,
        autoplay:true,
      margin: 0.01 * (window.innerWidth / 19.2 ),
      mouseDrag: true,
      touchDrag: true,
      pullDrag: false,
      freeDrag: false,
      autoplayTimeout:(sdai === 1 ? 2500 : 25000),
      autoplaySpeed:500,
        },
        1101:{
            items:(sdai === 1 ? 3 : 3),
            nav:true,
        autoplay:true,
      margin: 0.01 * (window.innerWidth / 19.2 ),
      mouseDrag: true,
      touchDrag: true,
      pullDrag: false,
      freeDrag: false,
      autoplayTimeout:(sdai === 1 ? 2500 : 25000),
      autoplaySpeed:500,
        },
    }
});
}

function dateActer2(way){
  if(way == 1){
    if(jQuery('input[name="date1"]').val().length == 10){
      jQuery('.cdtsK').removeClass('actdayn1');
      jQuery('.cdtsK').removeClass('testreserver');
      let day2 =  '#mday'+jQuery('input[name="date1"]').val().replace("-", "").replace("-", "");
      jQuery(day2).addClass('actdayn1');
      var allItemem2 = document.getElementsByClassName('cdtsK');
      var teste = 0;
      var badyt = 0;
      var actdayn2 = jQuery('.actdayn2');
      if(actdayn2){
        for (var adROWK2 = 0; adROWK2 < allItemem2.length; adROWK2++){
          if(jQuery(allItemem2[adROWK2]).hasClass('actdayn2') && teste != 1){
            badyt = 1;
          }
          if(badyt != 1){
            if(teste == 1){
              if(jQuery(allItemem2[adROWK2]).hasClass('actdayn2')){
                teste = 2;
              }else{
                jQuery(allItemem2[adROWK2]).addClass('testreserver');
              }
            }else{
              if(jQuery(allItemem2[adROWK2]).hasClass('actdayn1')){
                teste = 1;
              }
            }
          }
        }
      }
    }
  }
  if(way == 2){
    if(jQuery('input[name="date2"]').val().length == 10){
      jQuery('.cdtsK').removeClass('actdayn2');
      jQuery('.cdtsK').removeClass('testreserver');
      let day2 =  '#mday'+jQuery('input[name="date2"]').val().replace("-", "").replace("-", "");
      jQuery(day2).addClass('actdayn2');
      var allItemem2 = document.getElementsByClassName('cdtsK');
      var teste = 0;
      var badyt = 0;
      var actdayn1 = jQuery('.actdayn1');
      if(actdayn1){
        for (var adROWK2 = 0; adROWK2 < allItemem2.length; adROWK2++){
          if(jQuery(allItemem2[adROWK2]).hasClass('actdayn2') && teste != 1){
            badyt = 1;
          }
          if(badyt != 1){
            if(teste == 1){
              if(jQuery(allItemem2[adROWK2]).hasClass('actdayn2')){
                teste = 2;
              }else{
                jQuery(allItemem2[adROWK2]).addClass('testreserver');
              }
            }else{
              if(jQuery(allItemem2[adROWK2]).hasClass('actdayn1')){
                teste = 1;
              }
            }
          }
        }
      }
    }
  }
}
var clicker = 0;
jQuery(document).ready(function() {
	
jQuery('.cdtsK').on("click", function( event ) {
              var actd = jQuery(this).attr('data-attr-day');
              if(jQuery('input[name="date1"]').val().length < 3){
                jQuery('input[name="date1"]').val(actd);
                jQuery('input[name="date1"]').change();
                jQuery(this).addClass('actdayn1');
                jQuery('.cdtsK').removeClass('testreserver');
              }else{
                if(jQuery('input[name="date2"]').val().length < 3){
                  jQuery('.cdtsK').removeClass('actdayn2');
                  jQuery('input[name="date2"]').val(actd);
                  jQuery('input[name="date2"]').change();
                  jQuery(this).addClass('actdayn2');
                  const actDay = document.querySelector("td.actdayn1");
                  const actDay2 = document.querySelector("td.actdayn2");

                  var allItemem2 = document.getElementsByClassName('cdtsK');
                  var teste = 0;
                  var badyt = 0;
                  jQuery('.cdtsK').removeClass('testreserver');
                  for (var adROWK2 = 0; adROWK2 < allItemem2.length; adROWK2++){
                    if(jQuery(allItemem2[adROWK2]).hasClass('actdayn2') && teste != 1){
                      badyt = 1;
                    }
                    if(badyt != 1){
                      if(teste == 1){
                        if(jQuery(allItemem2[adROWK2]).hasClass('actdayn2')){
                          teste = 2;
                        }else{
                          jQuery(allItemem2[adROWK2]).addClass('testreserver');
                        }
                      }else{
                        if(jQuery(allItemem2[adROWK2]).hasClass('actdayn1')){
                          teste = 1;
                        }
                      }
                    }
                  }
                }else{
                  jQuery('.cdtsK').removeClass('testreserver');
                  jQuery('.cdtsK').removeClass('actdayn1');
                  jQuery('input[name="date1"]').val(actd);
                  jQuery(this).addClass('actdayn1');
                  jQuery('.cdtsK').removeClass('actdayn2');
                  jQuery('input[name="date2"]').val('');
                  jQuery('input[name="date2"]').change();
                }
              }
            });

/*jQuery('td.cdtsK').hover(function() {
  if(jQuery(this).parent('tr').parent('tbody').find('td.actdayn1')){
    // Get the td with the class 'actdayn1'
    const actDay = document.querySelector("td.actdayn1");
    const actDay2 = document.querySelector("td.actdayn2");

    if (actDay) {
      if(actDay2 == null || actDay2 == undefined){
        console.log(actDay2);
        // Get all td elements in the calendar
        const allDays = document.querySelectorAll("table.kolical td");

        // Add event listener to each td
        allDays.forEach(day => {
            day.addEventListener("mouseover", function() {
                // Get the index of the .actdayn1 td and the current hovered td
                let startIndex = Array.from(allDays).indexOf(actDay);
                let endIndex = Array.from(allDays).indexOf(day);
               //   endIndex = Array.from(allDays).indexOf(actDay2);
                
                // Ensure startIndex is less than endIndex
                if (startIndex > endIndex) {
                   // [startIndex, endIndex] = [endIndex, startIndex];
                }

                // Reset the background color of all td elements
                allDays.forEach(td => td.style.backgroundColor = "");
                allDays.forEach(td => td.style.color = "var(--global-color-11");

                // Set the background color of td elements between startIndex and endIndex
                for (let i = startIndex; i <= endIndex; i++) {
                    allDays[i].style.backgroundColor = "#a35593db";
                    allDays[i].style.color = "var(--global-color-10)";
                    
                }
            });
        });
      }
    }
  }
});*/
jQuery('td.cdtsK').hover(function() {
  if(jQuery(this).parent('tr').parent('tbody').find('td.actdayn1')){
    // Get the td with the class 'actdayn1'
    
  }
});



        // Get all td elements in the calendar
        const allDays = document.querySelectorAll("table.kolical td.cdtsK");

        // Add event listener to each td
        allDays.forEach(day => {
          day.addEventListener("mouseover", function() {
            let actDay = document.querySelector("td.actdayn1");
            let actDay2 = document.querySelector("td.actdayn2");
            if(actDay && actDay2 == null ){

                // Get the index of the .actdayn1 td and the current hovered td
                let startIndex = Array.from(allDays).indexOf(actDay);
                let endIndex = Array.from(allDays).indexOf(day);
               //   endIndex = Array.from(allDays).indexOf(actDay2);
                
                // Ensure startIndex is less than endIndex
                if (startIndex > endIndex) {
                   // [startIndex, endIndex] = [endIndex, startIndex];
                }

                // Reset the background color of all td elements
                allDays.forEach(td => td.style.backgroundColor = "");
                allDays.forEach(td => td.style.color = "var(--global-color-11");

                // Set the background color of td elements between startIndex and endIndex
                for (let i = startIndex; i <= endIndex; i++) {
                    allDays[i].style.backgroundColor = "#a35593db";
                    allDays[i].style.color = "var(--global-color-10)"; 
                }
            }else{
                // Reset the background color of all td elements
                allDays.forEach(td => td.style.backgroundColor = "");
                allDays.forEach(td => td.style.color = "var(--global-color-11");
            }
          });
        });
     

/*
*/
  jQuery( '.prodcalname2' ).click( function() {
    var tests = jQuery(this).html();
    jQuery('.wsz_d_c option').each(function() {
      if(jQuery(this).html() == tests){
        jQuery('.wsz_d_c').val(this.value);
      }
    });
  });

  jQuery( '.ajf' ).change( function() {
    if(jQuery(this).hasClass('wsz_d_1')){
      dateActer2(1);
      //jQuery('button.wp-block-search__button').click();
    }else if(jQuery(this).hasClass('wsz_d_2')){
      dateActer2(2);
      //jQuery('button.wp-block-search__button').click();
    }else{
      //jQuery('button.wp-block-search__button').click();
    }
  });
  jQuery( '.ajf[name="city"]' ).change( function() {
    if(jQuery(this).val() != ''){
      jQuery(this).css('border-color','var(--accnet)');
    }else{
      jQuery(this).css('border-color','lightgrey');
    }
  });
  
  
jQuery("a[href^=#]").click(function(e) {   
	e.preventDefault();
	var dest = jQuery(this).attr('href');
	if(dest.length > 3){
		jQuery('html,body').animate({ scrollTop: jQuery(dest).offset().top - 100 }, 'slow');
	}
});
	
	
  jQuery(".wp-image-7175").on('click', function(event) {
   	jQuery('.pchild').addClass('active_performers');
  });
	
	
	clicker = 0;
	jQuery('body').on("click", function( event ) {
      //console.log(clicker);
  });
	jQuery('.cdts').on("click", function( event ) {
    if(clicker != 1){
      jQuery('.cdts').removeClass('aktnap');
      clicker = 1;
      jQuery('.naptcont').attr('data-attr-relday',jQuery(this).attr('data-attr-relmi'));
      naptardayz(jQuery(this).attr('id').replace("-", "").replace("-", ""));
      jQuery(this).addClass('aktnap');
      jQuery('.dayz'+jQuery('.naptcont').attr('data-attr-relday')).addClass('aktnap');
      let allTestc = document.getElementsByClassName('naptar');
      let testCount = allTestc.length;
      setTimeout(function() {
        //jQuery(actdiv).addClass('aktnap');
        jQuery('.dayz'+jQuery('.naptcont').attr('data-attr-relday')).addClass('aktnap');
        for (var i2 = 0; i2 < testCount; i2++) {
          let allTestcCont = jQuery(allTestc[i2]).find('.aktnap');
          if(allTestcCont.length){
          }else{
            jQuery(allTestc[i2]).find('.dayz1').addClass('aktnap');
          }
        }
      }, 400);
    }
  });
  let unitest = document.getElementById("naptcont");
  if(unitest != null){
  //  clicker = 1;
    var actdiv = jQuery('td.cdts.aktnap');
    jQuery('.activeho').find(jQuery('td.cdts.aktnap')).click();
    setTimeout(function() {
      jQuery('.dayz'+jQuery('.naptcont').attr('data-attr-relday')).addClass('aktnap');
    }, 400);
  } 
 /*jQuery('.naptcont').on("click", function( event ) {
    if(clicker != 1){
      clicker = 1;
      jQuery('.naptcont').removeClass('activers');
    }
  });
  jQuery('.naptarend').on("click", function( event ) {
    if(clicker != 1){
      clicker = 1;
      jQuery('.naptcont').addClass('activers');
    }
  });*/
  jQuery('.hoarrow').on("click", function( event ) {
    if(clicker != 1){
      clicker = 1;
      var a = jQuery(this);
      naptars(a);
    }
  });
//      var a = jQuery(this).attr('data-attr-date');
  jQuery('.postarrow').on("click", function( event ) {
    if(clicker != 1){
      clicker = 1;
      var a = jQuery(this).attr('data-attr-date');
      jQuery('.cdts').removeClass('aktnap');
          
      jQuery('.naptcont').attr('data-attr-relday',parseInt(jQuery(this).attr('data-attr-edated')));
      
      if(jQuery(this).hasClass('arrnext')){
        if(parseInt(jQuery(this).attr('data-attr-datem')) == 12 && parseInt(jQuery(this).attr('data-attr-edatem')) < parseInt(jQuery(this).attr('data-attr-datem'))){
          clicker = 0;
          jQuery('.activeho').find('.honext').click();
        }else{
          if(parseInt(jQuery(this).attr('data-attr-edatem')) > parseInt(jQuery(this).attr('data-attr-datem'))){
            clicker = 0;
            jQuery('.activeho').find('.honext').click();
          }else{
            clicker = 0;
            jQuery('#mday'+jQuery(this).attr('data-attr-datey')+'-'+jQuery(this).attr('data-attr-datem')+'-'+jQuery(this).attr('data-attr-edated')).click();
            //naptardayz(a);
          }
        }
      }else if(jQuery(this).hasClass('arrprev')){
        if(parseInt(jQuery(this).attr('data-attr-datem')) == 1 && parseInt(jQuery(this).attr('data-attr-edatem')) > parseInt(jQuery(this).attr('data-attr-datem'))){
          clicker = 0;
          jQuery('.activeho').find('.hoprev').click();
        }else{
          if(parseInt(jQuery(this).attr('data-attr-edatem')) < parseInt(jQuery(this).attr('data-attr-datem'))){
            clicker = 0;
            jQuery('.activeho').find('.hoprev').click();
          }else{
            clicker = 0;
            jQuery('#mday'+jQuery(this).attr('data-attr-datey')+'-'+jQuery(this).attr('data-attr-datem')+'-'+jQuery(this).attr('data-attr-edated')).click();
            //naptardayz(a);
          }
        }
      }else{
        clicker = 0;
        jQuery('#mday'+jQuery(this).attr('data-attr-datey')+'-'+jQuery(this).attr('data-attr-datem')+'-'+jQuery(this).attr('data-attr-edated')).click();
        //naptardayz(a);
      }
    }
  });
		/**/
	  let escrolltest2 = document.getElementById("edumegy");
  if(escrolltest2 != null){
    var owle = jQuery('#edumegy');
    startcarouselemAller(owle);
  } 
let escrolltest = document.getElementById("idemegy");
  if(escrolltest != null){
	  var owl = jQuery('.idemegy');
    startcarouselem(owl);
  }	
let escrolltest222 = document.getElementById("idemegy2");
  if(escrolltest222 != null && escrolltest != null){
	  var owl222 = jQuery('.idemegy2');
      if(owl222.hasClass('sdai')){
	startcarouselem33(owl222);
	  }else{
	//startcarouselem(owl222);	  
	  }
  }	
	
	if(jQuery('body').hasClass('home')){
		window.onscroll = function() {
			var distanceScrolled = document.documentElement.scrollTop;
			if (distanceScrolled > 84) {
			  jQuery('#masthead').addClass('stucker');
			}else{
			  jQuery('#masthead').removeClass('stucker');
			}
		}
	}
	/*
	 jQuery('.naptcont').on("click", function( event ) {
    jQuery('.naptcont').removeClass('activers');
  });
  jQuery('.naptarend').on("click", function( event ) {
    jQuery('.naptcont').addClass('activers');
  });
  jQuery('.hoarrow').on("click", function( event ) {
    var a = jQuery(this);
    naptars(a);
  });*/
jQuery('.cdts').on("mouseover", function( event ) {
      var rrrr = jQuery(this).attr('id');
      var tesi = document.getElementsByClassName('piar'+rrrr);
      if(tesi.length < 1){
        if(jQuery(this).attr('data-attr-tooltip') != undefined){

      jQuery(this).append('<div class="tooltipps piar'+rrrr+'">'+jQuery(this).attr('data-attr-tooltip')+'</div>');
        }
      setTimeout(function() {
        jQuery('.piar'+rrrr).css('opacity',1);
        jQuery('.piar'+rrrr).css('top','-42px');
      }, 200);
      }
  });
    jQuery('.cdts').on("mouseleave", function( event ) {
      var rrrr = jQuery(this).attr('id');
    setTimeout(function() {
      jQuery('.piar'+rrrr).css('opacity',0);
      setTimeout(function() {
        jQuery('.piar'+rrrr).remove();
      }, 200);
    }, 1800);
  });
	
	
ferohelytest();  
  jQuery("#pa_ferohelyek").on('change', function(event) {
    ferohelytest();
    setTimeout(function() { 
      ferohelytest();
    }, 1200);
  });
  jQuery("#picker__holder").on('click', function(event) {
    ferohelytest();
  });
  jQuery("#picker__footer").find('button').on('click', function(event) {
    ferohelytest();
  });
  jQuery(".thwepof-input-field").on('blur change keyup', function(event) {
    ferohelytest();
    setTimeout(function() { 
      ferohelytest();
    }, 1200);
  });
  jQuery("#start_date").on('change', function(event) {
    setTimeout(function() { 
      ferohelytest();
    }, 1200);
  });
  jQuery("#end_date").on('change', function(event) {
    setTimeout(function() { 
      ferohelytest();
    }, 1200);
  });
  jQuery(".variations_form").on('click', function(event) {
    setTimeout(function() { 
      ferohelytest();
    }, 1200);
  });
/*jQuery("a").on('click', function(event) {
  if (this.hash !== "") {
   // event.preventDefault();
    var hash = this.hash;
    jQuery('html, body').animate({
      scrollTop: jQuery(hash).offset().top
    }, 800, function(){
    //window.location.hash = hash;
    });
  }
});*/

if(jQuery('body').hasClass('tml-action-profile') && jQuery('body').hasClass('logged-in')){
  jQuery('.wpfda-delete-account-ct').click(function() {
    if(jQuery('.wpfda-delete-account-container').hasClass('active')){
      jQuery('.wpfda-delete-account-container').removeClass('active');
      jQuery(this).removeClass('dellc');
      jQuery(this).html('TĂśrlĂŠs');
    }else{
      jQuery('.wpfda-delete-account-container').addClass('active');
      jQuery(this).addClass('dellc');
      jQuery(this).html('MĂŠgse');
    }
  });
}

/*
var mans = jQuery('.masonry-container');
  if(mans.length){
	  
      setTimeout(function() { 
		  if($grid != undefined){
        $grid.masonry( 'layout' );  
		  }
		  
      setTimeout(function() { 
		  
		  if($grid != undefined){
        $grid.masonry( 'layout' );
		  console.log('laast');
		  }
      }, 800);
      }, 2400);
  }*/
    var testv = jQuery('.tml-register');
  if(testv.length || (jQuery('body').hasClass('tml-action-profile') && jQuery('body').hasClass('logged-in'))){
    jQuery('select[name="uni_suli"]').attr('id','getscholler');
    schooler();
    jQuery( 'body' ).on( 'change', 'select[name="uni_suli"]', function(){
      schooler();
    });
  }
  if(testv.length){
    jQuery(function($){
        $( 'body' ).on( 'click blur change keyup keydown', '.numvali', function(){
            numVali($(this));
        });
        $( 'body' ).on( 'blur change keyup', 'input#user_email', function(){
            mailVali($(this));
        });
        $( 'body' ).on( 'blur change keyup', 'input#user_login', function(){
            logVali($(this));
        });
        $( 'body' ).on( 'blur change keyup', 'input#user_pass', function(){
            passVali($(this));
        });
        $( 'body' ).on( 'change', '.requval', function(){
            reqVali($(this));
        });
    });
    if(jQuery('.tml-alerts').html() != ''){
      var allItemem = 'asdfghjkl';
      allItemem = document.getElementsByClassName('numvali');
      for (var adROWK = 0; adROWK < allItemem.length; adROWK++){
        numVali(jQuery(allItemem[adROWK]));
      }
      var allItemem2 = 'asdfghjkl';
      allItemem2 = document.getElementsByClassName('requval');
      for (var adROWK2 = 0; adROWK2 < allItemem2.length; adROWK2++){
        reqVali(jQuery(allItemem2[adROWK2]));
      }
      var testItemem = jQuery('#user_email');
      if(testItemem.length){
        mailVali(testItemem);
      }
      var testItemem2 = jQuery('#user_login');
      if(testItemem2.length){
        logVali(testItemem2);
      }
      var testItemem3 = jQuery('#user_pass');
      if(testItemem3.length){
        passVali(testItemem3);
      }
    }
    jQuery('.tml-label[for="pass1"]').after( '<div class="openpass ps1"><span class="dashicons dashicons-visibility"></span><span class="dashicons dashicons-hidden"></span></div>' );
    jQuery('.tml-label[for="pass2"]').after( '<div class="openpass ps2"><span class="dashicons dashicons-visibility"></span><span class="dashicons dashicons-hidden"></span></div>' );
    jQuery( 'body' ).on( 'click', '.ps1', function(){
        var x = document.getElementById("pass1");
        if (x.type != "text") {
            x.type = "text";
            jQuery(this).addClass('open');
        } else {
            x.type = "password";
            jQuery(this).removeClass('open');
        }
    });
    jQuery( 'body' ).on( 'click', '.ps2', function(){
        var x = document.getElementById("pass2");
        if (x.type != "text") {
            x.type = "text";
            jQuery(this).addClass('open');
        } else {
            x.type = "password";
            jQuery(this).removeClass('open');
        }
    });
  }
	  testv = '';
	  testv = jQuery('#user_pass');
	  if(testv.length){
		jQuery('.tml-label[for="user_pass"]').after( '<div class="openpass ps1"><span class="dashicons dashicons-visibility"></span><span class="dashicons dashicons-hidden"></span></div>' );
		jQuery( 'body' ).on( 'click', '.ps1', function(){
			var x = document.getElementById("user_pass");
			if (x.type != "text") {
				x.type = "text";
				jQuery(this).addClass('open');
			} else {
				x.type = "password";
				jQuery(this).removeClass('open');
			}
		});
	  }
	
var testinsta = jQuery('.instagram-mediaoff');
    if(testinsta.length){
     
		if(typeof instgrm != 'undefined'){
        	instgrm.Embeds.process();
        	console.log('insta_process');
      	}else{ 
        	setTimeout(function() { 
        		if(typeof instgrm != 'undefined'){
          			instgrm.Embeds.process();
          			console.log('insta_process2');
        		}else{ 
					setTimeout(function() { 
						if(typeof instgrm != 'undefined'){
							instgrm.Embeds.process();
							console.log('insta_process3');
						}else{ 
							setTimeout(function() { 
								if(typeof instgrm != 'undefined'){
									instgrm.Embeds.process();
									console.log('insta_process4');
								}else{ 
									setTimeout(function() { 
										if(typeof instgrm != 'undefined'){
											instgrm.Embeds.process();
											console.log('insta_process5');
										}else{
											console.log('no_insta_process');
										}
									}, 1800);
								}
							}, 1800);
						}
					}, 1800);
				}
      		}, 1800);
		}
    
	}
	
	/*
  if(jQuery('body').hasClass('home')){
	  if(jQuery('body').hasClass('admin-barxaxa')){
		 
		 
			  let infScroll = new InfiniteScroll( '.masonry-container', {
path: '.infinite-scroll-path a',
append: "#main .infinite-scroll-item",
history: 'replace',
loadOnScroll: true,
button: null,
scrollThreshold: 600,
});
		    var $masonry_container = jQuery( '.masonry-container' );
    var msnry = false;

	        var $grid = $masonry_container.masonry({
        columnWidth: '.grid-sizer',
        itemSelector: 'none',
        stamp: '.page-header',
        percentPosition: true,
        stagger: 30,
        visibleStyle: { transform: 'translateY(0)', opacity: 1 },
        hiddenStyle: { transform: 'translateY(5px)', opacity: 0 },
      } );
	  
	  setTimeout(function() { 


    if ( $masonry_container.length ) {

      jQuery( '.masonry-container' ).css('opacity','1');
      var $grid = $masonry_container.masonry({
        columnWidth: '.grid-sizer',
        itemSelector: 'none',
        stamp: '.page-header',
        percentPosition: true,
        stagger: 30,
        visibleStyle: { transform: 'translateY(0)', opacity: 1 },
        hiddenStyle: { transform: 'translateY(5px)', opacity: 0 },
      } );

      msnry = $grid.data( 'masonry' );

      //$grid.imagesLoaded( function() {
        $grid.masonry( 'layout' );
       // $grid.removeClass( 'are-images-unloaded' );
       // jQuery( '.load-more' ).removeClass( 'are-images-unloaded' );
       // jQuery( '#nav-below' ).css( 'opacity', '1' );
        $grid.masonry( 'option', { itemSelector: '.masonry-post' });
        var $items = $grid.find( '.masonry-post' );
        $grid.masonry( 'appended', $items );
     // } );

      jQuery( '#nav-below' ).insertAfter( '.masonry-container' );

      jQuery( window ).on( "orientationchange", function( event ) {
        $grid.masonry( 'layout' );
      } );
    }   
      }, 1100);
		  
		  
  }else{
	  
  
	  
	      var $masonry_container = jQuery( '.masonry-container' );
    var msnry = false;

	        var $grid = $masonry_container.masonry({
        columnWidth: '.grid-sizer',
        itemSelector: 'none',
        stamp: '.page-header',
        percentPosition: true,
        stagger: 30,
        visibleStyle: { transform: 'translateY(0)', opacity: 1 },
        hiddenStyle: { transform: 'translateY(5px)', opacity: 0 },
      } );
	  
	  setTimeout(function() { 


    if ( $masonry_container.length ) {

      jQuery( '.masonry-container' ).css('opacity','1');
      var $grid = $masonry_container.masonry({
        columnWidth: '.grid-sizer',
        itemSelector: 'none',
        stamp: '.page-header',
        percentPosition: true,
        stagger: 30,
        visibleStyle: { transform: 'translateY(0)', opacity: 1 },
        hiddenStyle: { transform: 'translateY(5px)', opacity: 0 },
      } );

      msnry = $grid.data( 'masonry' );

      //$grid.imagesLoaded( function() {
        $grid.masonry( 'layout' );
       // $grid.removeClass( 'are-images-unloaded' );
       // jQuery( '.load-more' ).removeClass( 'are-images-unloaded' );
       // jQuery( '#nav-below' ).css( 'opacity', '1' );
        $grid.masonry( 'option', { itemSelector: '.masonry-post' });
        var $items = $grid.find( '.masonry-post' );
        $grid.masonry( 'appended', $items );
     // } );

      jQuery( '#nav-below' ).insertAfter( '.masonry-container' );

      jQuery( window ).on( "orientationchange", function( event ) {
        $grid.masonry( 'layout' );
      } );
    }   
		  
	  setTimeout(function() { 
		  $grid.masonry( 'layout' );
      }, 2100);
		  
      }, 1100);
/*
	$container.infiniteScroll( {
path: '.infinite-scroll-path a',
append: "#main .infinite-scroll-item",
history: 'replace',
loadOnScroll: true,
button: null,
scrollThreshold: 600,
} );
* /
  }
  
  }
	*/
	
	jQuery( function( $ ) {
/*$( 'li.product .qty' ).change( function() {

  const qty = $(this).val();

  $(this).parent().next().attr( 'data-quantity', qty );

} );*/

  $( '.rudr-variation-select' ).find( 'select[data-attribute_name]' ).change( function() {

    const el = $(this);
    const variationsWrapper = el.closest( '.rudr_variations' );
    const availableVariations = JSON.parse( variationsWrapper.attr( 'data-product_variations' ) );
    const productWrapper = variationsWrapper.closest( 'li.product' );
    const button = productWrapper.find( '.add_to_cart_button' );

    // our matching variation will be stored in this object
    let matchingVariation = {};

    // now we can loop through all the variations and check them against the selected attributes
    for( let i = 0; i < availableVariations.length; i++ ) {
      // assign it as a matching variation in any case
      matchingVariation = availableVariations[i];

      // let's check all the attributes of this variation
      for( const [ attr_name, attr_value ] of Object.entries( availableVariations[i].attributes ) ) {
        // if any of attributes doesn't match
        if( attr_value !== variationsWrapper.find( '[name="' + attr_name + '"]' ).val() ) {
          matchingVariation = {};
        }
      }

      // exit the loop if we have a matching variation
      if( Object.keys( matchingVariation ).length !== 0 ) {
        break;
      }

    }

    // add a variation ID to the Add to cart button
    if( matchingVariation.variation_id ) {
      button.removeClass( 'disabled' ).addClass( 'ajax_add_to_cart' );
      button.attr( 'data-product_id', matchingVariation.variation_id );

      /*const sdate = $(this).parent().parent().find('input[name="start_date_submit"]').val();
      const edate = $(this).parent().parent().find('input[name="end_date_submit"]').val();*/
      const sdate = $(this).parent().parent().find('input[name="start_date"]').val();
      const edate = $(this).parent().parent().find('input[name="end_date"]').val();

      const dates = '&&start_date='+sdate+'&&end_date='+edate;
      
      button.attr( 'href', button.attr( 'data-attr-href') +'?add-to-cart=' + matchingVariation.variation_id+dates );

    }
    // update product price
    if( matchingVariation.price_html ) {
      productWrapper.find( 'span.price').replaceWith( matchingVariation.price_html );
    }
    /*
    // update product image
    if( matchingVariation.image ) {
      productWrapper.find( 'img' ).attr( {
        src: matchingVariation.image.src,
        srcset: matchingVariation.image.srcset,
        width: matchingVariation.image.src_w,
        height: matchingVariation.image.src_h
      } );
    }
*/
  } );
      
            jQuery('.text_ifa .description').on("click", function( event ) {
				if(jQuery(this).hasClass('activers')){
					jQuery(this).removeClass('activers');
				}else{	
					jQuery(this).addClass('activers');
				}
			});
		
		
$( '.custom-add-to-cart' ).click( function( event ) {
  
    event.preventDefault();

    if ( 'undefined' === typeof wc_add_to_cart_params ) {
      return false;
    }


    const prId = parseInt($(this).attr('data-product_id'));
    const sdate = jQuery('input[name="date1"]').val();
    const edate = jQuery('input[name="date2"]').val();
    const equan = $(this).parent().find('select[name="quan"]').val();
    if(prId !== null && prId !== ''){
      const data = {
        product_id: prId,
        quantity: equan,
        start_date_submit: sdate,
        end_date_submit: edate,
        start_format: sdate,
        end_format: edate,
      }

       $.ajax( {
        type: 'POST',
        url: wc_add_to_cart_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'add_to_cart' ),
        data: data,
        dataType: 'json',
        beforeSend: function( xhr ) {
          // you can set the button loading state here
        },
        complete: function( res ) {
          // you can remove the button loading state here
          //return false;
        },
        success: function( res ) {
          if ( res.error || res.product_url ) {
          }else{
            $( document.body ).trigger( 'added_to_cart', [ res.fragments, res.cart_hash ] );
          }
        },
      });
    }else{
     // alert('test');
    }

  } );


} );



//filter
const ajaxFilter = document.getElementById( 'ajax-filter' )
const siteContent = document.getElementById( 'site-content' )
    if(ajaxFilter != null){
    
ajaxFilter.addEventListener( 'submit', event => {
  
  event.preventDefault();

  siteContent.classList.add( 'is-loading' )

  const formData = new FormData( event.target ) // similar to jQuery's serialize()

  var ajaxurl = 'https://universum.hu/wp-admin/admin-ajax.php' + '?action=ajaxfilter2';
  fetch( ajaxurl, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify( Object.fromEntries( formData.entries() ) ),
  }).then( response => {
    return response.text()
  }).then( response => {

    if( response ) {
      if(response.slice(-1) == '0'){
          response = response.slice(0, -1) 
      }else if(response.charAt(0) == '0'){
          response = response.substring(1);
      }
      siteContent.innerHTML = response;

      // setTimeout(function() {
      jQuery( 'li.product .loopq' ).change( function() {

        const qty = jQuery(this).val();

        jQuery(this).parent().parent().find('a.custom-add-to-cart').attr( 'data-quantity', qty );

      } );
            var allq = document.getElementsByClassName('loopq');
            for (var adROWK2 = 0; adROWK2 < allq.length; adROWK2++){
              loopqInit(allq[adROWK2]);
            }

            setTimeout(function() {
              var owl = jQuery('.idemegy');
              startcarouselem(owl);
            }, 300);
            setTimeout(function() {
              var owl2 = jQuery('.idemegy2');
              startcarouselem33(owl2);
            }, 400);

	
				
		var acc2 = document.getElementsByClassName('place_description');
            var i2;
            for (i2 = 0; i2 < acc2.length; i2++) {
                acc2[i2].onclick = function () {
                    this.classList.toggle("activers2");

                    var panel2 = this;
					
                    if (panel2.style.maxHeight != '72px' && panel2.style.maxHeight != '' ) {
                        panel2.style.maxHeight = "72px";
                    } else {
                        panel2.style.maxHeight = panel2.scrollHeight + "px";
                    }
                   
                }
            }
		
		
		var acc = document.getElementsByClassName('show_item_btn');
            var i;
            for (i = 0; i < acc.length; i++) {
                acc[i].onclick = function () {
                    //this.classList.toggle("activers");

                    var panel = this.parentElement.nextElementSibling;

                    if (panel.style.maxHeight) {
						this.innerHTML = 'Mutasd a találatokat!';
                        panel.style.maxHeight = null;
                    } else {
						this.innerHTML = 'Találatok elrejtése';
                        panel.style.maxHeight = panel.scrollHeight + "px";
                    }
                   
                }
            }
          
		
            jQuery( '.custom-add-to-cart' ).click( function( event ) {
              
                event.preventDefault();
                if(!jQuery(this).hasClass('disabled')){
                  if ( 'undefined' === typeof wc_add_to_cart_params ) {
                    return false;
                  }


                  const prIda = parseInt(jQuery(this).attr('data-product_id_a'));
                  const prId = parseInt(jQuery(this).attr('data-product_id'));
 
                  var sdate = jQuery('input[name="date1"]').val()+'';
                  var edate = jQuery('input[name="date2"]').val()+'';

                  if(edate == '' || edate == ' '){
                    edate = sdate;
                  }

                  /*
                  if(edate == '' || edate === sdate){
                    var tdate = new Date(sdate);
                    tdate.setDate(tdate.getDate() + 1);
                    var month   = tdate.getUTCMonth() + 1; // months from 1-12
                        month   = month < 10 ? '0'+month : month;
                    var day     = tdate.getUTCDate();
                        day   = day < 10 ? '0'+day : day;
                    var year    = tdate.getUTCFullYear();

                    edate = year + "-" + month + "-" + day;
                  }
                  */
 
                  const equan = jQuery(this).attr('data-quantity');
                  const feroh = jQuery(this).parent().find('select[name="attribute_pa_ferohelyek"]').val();
                  const diak = jQuery(this).parent().find('select[name="attribute_pa_diak"]').val();
  /*

          "variation" : {
              "size" : "xl",
              "color": "pink"
          },

  */
  //                    variation_id: prIda,
                      /*variation : {
                          'attribute_ferohelyek' : feroh,
                          'attribute_diak': diak,
                      },*/

                  if(prId !== null && prId !== ''){
                      
                      const data = { 
                        action: 'woocommerce_ajax_add_to_cart',
                        variation : {
                          attribute_pa_ferohelyek : feroh,
                          attribute_pa_diak: diak,
                        },
                        product_id: prIda,
                        variation_id: prId,
                        product_sku: '',
                        quantity: equan,
                        start_format: sdate,
                        start_date_submit: sdate,
                        end_format: edate,
                        end_date_submit: edate,
                      }


                    jQuery.ajax( {
                      type: 'POST',
                      //url: wc_add_to_cart_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'add_to_cart' ),
                      url: wc_add_to_cart_params.ajax_url,  
                      data: data,
                      dataType: 'json',
                      beforeSend: function( xhr ) {
                        // you can set the button loading state here
                      },
                      complete: function( res ) {
                        // you can remove the button loading state here
                        //return false;
                      },
                      success: function( res ) {
                        if ( res.error || res.product_url ) {
                          //window.location = response.product_url;
                          //return false;
                        }else{
                          jQuery( document.body ).trigger( 'added_to_cart', [ res.fragments, res.cart_hash ] );
                          //jQuery('button.wp-block-search__button').click();
                        }
                      },
                    });


                   
                  }else{
                   // alert('test');
                  }

                    //}, 400);
                }
  

  } );
  //jQuery( '.rudr-variation-select' ).find( 'select[data-attribute_name]' ).change( function() {


      setTimeout(function() {
            jQuery( '.rudr-variation-select select' ).on("click change blur", function( event ) {
                const el = jQuery(this);
                const variationsQ = el.closest( '.rudr_variations' ).find('.loopq').val();
                const variationsWrapper = el.closest( '.rudr_variations' );
                const availableVariations = JSON.parse( variationsWrapper.attr( 'data-product_variations' ) );
                const productWrapper = variationsWrapper.closest( 'li.product' );
                const button = productWrapper.find( '.add_to_cart_button' );

                // our matching variation will be stored in this object
                let matchingVariation = {};

                // now we can loop through all the variations and check them against the selected attributes
                for( let i = 0; i < availableVariations.length; i++ ) {
                  // assign it as a matching variation in any case
                  matchingVariation = availableVariations[i];

                  // let's check all the attributes of this variation
                  for( const [ attr_name, attr_value ] of Object.entries( availableVariations[i].attributes ) ) {
                    // if any of attributes doesn't match
                    if( attr_value !== variationsWrapper.find( '[name="' + attr_name + '"]' ).val() && attr_value != '' ) {
                      matchingVariation = {};
                    }
                  }

                  // exit the loop if we have a matching variation
                  if( Object.keys( matchingVariation ).length !== 0 ) {
                    break;
                  }

                }

                // add a variation ID to the Add to cart button
                if( matchingVariation.variation_id) {
               
                  button.attr( 'data-product_id', matchingVariation.variation_id );
if(variationsQ != 0){
                  button.attr( 'disabled', '' );
   button.removeClass( 'disabled' ).addClass( 'ajax_add_to_cart' );
}else{
	         button.removeClass( 'ajax_add_to_cart' ).addClass( 'disabled' );
					
                  button.attr( 'disabled', 'disabled' );
					
                  button.attr( 'data-product_id', '' );
}
                  /*const sdate = $(this).parent().parent().find('input[name="start_date_submit"]').val();
                  const edate = $(this).parent().parent().find('input[name="end_date_submit"]').val();*/
                  const sdate = jQuery('input[name="date1"]').val();
                  const edate = jQuery('input[name="date2"]').val();

                  const dates = '&&start_date='+sdate+'&&end_date='+edate;
                  
                  //button.attr( 'href', button.attr( 'data-attr-href') +'?add-to-cart=' + matchingVariation.variation_id+dates );

                }else{
                  button.removeClass( 'ajax_add_to_cart' ).addClass( 'disabled' );
					
                  button.attr( 'disabled', 'disabled' );
					
                  button.attr( 'data-product_id', '' );
                }
                // update product price
                if( matchingVariation.price_html ) {
                  productWrapper.find( 'span.price').replaceWith( matchingVariation.price_html );
                }
                /*
                // update product image
                if( matchingVariation.image ) {
                  productWrapper.find( 'img' ).attr( {
                    src: matchingVariation.image.src,
                    srcset: matchingVariation.image.srcset,
                    width: matchingVariation.image.src_w,
                    height: matchingVariation.image.src_h
                  } );
                }
            */
              } );


                  }, 400);
    }
    siteContent.classList.remove( 'is-loading' )
    // console.log( response );

  }).catch( error => {
    console.log( error )
  })

} )
}


	
	
});