Nos cintres personnalisés dessins
        Témoin parfaite \"végétal\" 
             
                     
     
        
        
              
        ';
                wish_html +=        '
';
                wish_html +=        '
Template for
';
                wish_html +=        '
'+parent.attr('data-title')+'
';
                wish_html +=    '
';
                wish_html += '
 ';
            jQuery('.nbd-sidebar-con-inner.wishlist').prepend(wish_html);
        }
    };
    var nbd_preview_html = [];
    var previewTempalte = function(e, tid){
        e.preventDefault();
        NBDPopup.initPopup();
        if( nbd_preview_html[tid] != undefined ){
            jQuery('.nbd-popup-content-inner').html(nbd_preview_html[tid]);
        }else{
            jQuery('#nbd-popup-loading').removeClass('hide');
            jQuery('.nbd-popup-content-inner').addClass('hide');
            jQuery.ajax({
                url: nbds_frontend.url,
                method: "POST",
                data: 'action=nbd_get_template_preview&template_id='  +  tid  + '&nonce=' + nonce
            }).done(function(data){
                if( data.flag == 1 ){
                    jQuery('.nbd-popup-content-inner').html(data.html);
                    nbd_preview_html[tid] = data.html;
                }
                jQuery('#nbd-popup-loading').addClass('hide');
                jQuery('.nbd-popup-content-inner').removeClass('hide');
            });
        }
    };
    var nbd_list_product_html = '';
    var showPopupCreateTemplate = function(){
        NBDPopup.initPopup();
        if( nbd_list_product_html != '' ){
            jQuery('.nbd-popup-content-inner').html( nbd_list_product_html );
        }else{
            jQuery('#nbd-popup-loading').removeClass('hide');
            jQuery('.nbd-popup-content-inner').addClass('hide');
            jQuery.ajax({
                url: nbds_frontend.url,
                method: "POST",
                data: 'action=nbd_get_list_product_ready_to_create_template'  + '&nonce=' + nonce
            }).done(function(data){
                if( data.flag == 1 ){
                    jQuery('.nbd-popup-content-inner').html(data.html);
                    nbd_list_product_html = data.html;
                }
                jQuery('#nbd-popup-loading').addClass('hide');
                jQuery('.nbd-popup-content-inner').removeClass('hide');
            });
        }
    };  
    var nbd_preview_product_html = [];
    var previewNBDProduct = function(pid){
        if( nbd_preview_product_html[pid] != undefined ){
            jQuery('.nbd-popup-content-inner').html(nbd_preview_product_html[pid]);
        }else{
            jQuery('#nbd-popup-loading').removeClass('hide');
            jQuery('.nbd-popup-content-inner').addClass('hide');
            jQuery.ajax({
                url: nbds_frontend.url,
                method: "POST",
                data: 'action=nbd_get_preview_product_before_create_template&product_id='  +  pid  + '&nonce=' + nonce + '&art_id=' + art_id
            }).done(function(data){
                if( data.flag == 1 ){
                    jQuery('.nbd-popup-content-inner').html(data.html);
                    nbd_preview_product_html[pid] = data.html;
                }
                jQuery('#nbd-popup-loading').addClass('hide');
                jQuery('.nbd-popup-content-inner').removeClass('hide');
            });
        }
    };
    var changePreviewImage = function(e){
        var src = jQuery(e).attr('src');
        jQuery('.nbd-popup-list-preview img').removeClass('active');
        jQuery(e).addClass('active');
        jQuery('#nbd-popup-large-preview').attr('src', src);
    };
    var switchNBDProductVariation = function(e){
        var vid = jQuery(e).val(),
        btn = jQuery('#nbd-popup-link-create-template'),
        origin_fref = btn.data('href'),
        new_href = origin_fref + '&variation_id=' + vid;
        btn.attr('href', new_href);
    }
    jQuery( document ).ready(function(){
        var templates = '[]';
        localStorage.setItem("nbd_favourite_templates", templates);  
        renderNBDGallery( true );
        NBDPopup.calcWidth();
    }); 
    jQuery("body").click(function(e) {
        if(e.target.id == 'nbd-popup'){
            NBDPopup.hidePopup();
        }
    });
    jQuery(document).bind('keydown', function(e) {
        if( e.which == 27 ){
            NBDPopup.hidePopup();
        }
    });
    jQuery(window).on('resize', function () {
        NBDPopup.calcWidth();
    });
    var isNBDLoading = false;
    jQuery(window).on('scroll', function () {
        !isNBDLoading && (nbd_page.current_page = docViewTop));
    };