jQuery(document).ready(function($) {
    // var $ = jQuery;

    var videoPopupOnClick = $('.video_popup.open_video');

    if(videoPopupOnClick.length) {
        $.each(videoPopupOnClick, function(key, el) {
            var dataID          = $(el).data('id'); // video id
            var videoItemImg    = $(el).find('.videoItemImg');
            var content         = $(el).parent('.content');
            var url             = 'https://img.youtube.com/vi/' + dataID + '/0.jpg';

            el.style.backgroundImage = "url('" +url+ "')";
            el.style.minHeight = '390px';

            if(videoItemImg) {
                videoItemImg.css('visibility', 'hidden ');
            }

            if(content) {
                content.css('min-height', '400px');
            }
        })
    }

    var countSearch = 0;

    $( document ).ajaxComplete(function( event, xhr, settings ) {
        if (settings.url.toString().indexOf('store_search') !== -1) {
            countSearch++;
            if (countSearch > 1) {
                $('#wpsl-result-list').addClass('show');
            }
        }
    });
});